diff --git a/common/pom.xml b/common/pom.xml index b0afb32d2153..f0cf21118ade 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -56,6 +56,20 @@ com.fasterxml.jackson.core jackson-databind + + + tools.jackson.core + jackson-databind + + + tools.jackson.core + jackson-core + + + tools.jackson.core + jackson-annotations + com.google.code.gson gson diff --git a/openmetadata-k8s-operator/pom.xml b/openmetadata-k8s-operator/pom.xml index fefe436e8b0d..6bca09a25dba 100644 --- a/openmetadata-k8s-operator/pom.xml +++ b/openmetadata-k8s-operator/pom.xml @@ -23,7 +23,7 @@ 21.0.1 - 2.17.2 + 2.21.2 diff --git a/openmetadata-mcp/src/main/java/org/openmetadata/mcp/server/auth/validators/IdTokenValidator.java b/openmetadata-mcp/src/main/java/org/openmetadata/mcp/server/auth/validators/IdTokenValidator.java index 4d3c431dfabf..f9aa91f9246e 100644 --- a/openmetadata-mcp/src/main/java/org/openmetadata/mcp/server/auth/validators/IdTokenValidator.java +++ b/openmetadata-mcp/src/main/java/org/openmetadata/mcp/server/auth/validators/IdTokenValidator.java @@ -287,10 +287,11 @@ private Algorithm getAlgorithm(String algorithm, RSAPublicKey publicKey) { case "RS256" -> Algorithm.RSA256(publicKey, null); case "RS384" -> Algorithm.RSA384(publicKey, null); case "RS512" -> Algorithm.RSA512(publicKey, null); - default -> throw new IllegalArgumentException( - "Unsupported token validation algorithm: " - + algorithm - + ". Supported: RS256, RS384, RS512"); + default -> + throw new IllegalArgumentException( + "Unsupported token validation algorithm: " + + algorithm + + ". Supported: RS256, RS384, RS512"); }; } diff --git a/openmetadata-mcp/src/main/java/org/openmetadata/mcp/server/transport/OAuthHttpStatelessServerTransportProvider.java b/openmetadata-mcp/src/main/java/org/openmetadata/mcp/server/transport/OAuthHttpStatelessServerTransportProvider.java index d63d83bcd37b..94ab8a4dcfee 100644 --- a/openmetadata-mcp/src/main/java/org/openmetadata/mcp/server/transport/OAuthHttpStatelessServerTransportProvider.java +++ b/openmetadata-mcp/src/main/java/org/openmetadata/mcp/server/transport/OAuthHttpStatelessServerTransportProvider.java @@ -360,8 +360,8 @@ private static List getSupportedScopesForProvider() { } return switch (provider) { case GOOGLE -> List.of("openid", "profile", "email"); - case OKTA, AUTH_0, AWS_COGNITO, CUSTOM_OIDC -> List.of( - "openid", "profile", "email", "offline_access"); + case OKTA, AUTH_0, AWS_COGNITO, CUSTOM_OIDC -> + List.of("openid", "profile", "email", "offline_access"); case AZURE -> List.of("openid", "profile", "email", "offline_access"); default -> List.of("openid", "profile", "email"); }; diff --git a/openmetadata-service/pom.xml b/openmetadata-service/pom.xml index c18bb9c65ef1..65898212e13b 100644 --- a/openmetadata-service/pom.xml +++ b/openmetadata-service/pom.xml @@ -29,7 +29,7 @@ 12.1.7 1.5.25 1.5.25 - 2.3.0 + 2.4.0 24.0.0 diff --git a/openmetadata-service/src/main/java/org/openmetadata/csv/EntityCsv.java b/openmetadata-service/src/main/java/org/openmetadata/csv/EntityCsv.java index fcc0fd34e6e1..086a1dbf489f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/csv/EntityCsv.java +++ b/openmetadata-service/src/main/java/org/openmetadata/csv/EntityCsv.java @@ -647,31 +647,36 @@ private void validateExtension( fieldValue = parseEntityReferences(printer, csvRecord, fieldNumber, fieldValue.toString(), isList); } - case "date-cp", "dateTime-cp", "time-cp" -> fieldValue = - parseFormattedDateTimeField( - printer, - csvRecord, - fieldNumber, - fieldName, - fieldValue.toString(), - customPropertyType, - propertyConfig); - case "enum" -> fieldValue = - parseEnumType( - printer, - csvRecord, - fieldNumber, - fieldName, - customPropertyType, - fieldValue, - propertyConfig); - case "timeInterval" -> fieldValue = - parseTimeInterval(printer, csvRecord, fieldNumber, fieldName, fieldValue); - case "number", "integer", "timestamp" -> fieldValue = - parseLongField( - printer, csvRecord, fieldNumber, fieldName, customPropertyType, fieldValue); - case "table-cp" -> fieldValue = - parseTableType(printer, csvRecord, fieldNumber, fieldName, fieldValue, propertyConfig); + case "date-cp", "dateTime-cp", "time-cp" -> + fieldValue = + parseFormattedDateTimeField( + printer, + csvRecord, + fieldNumber, + fieldName, + fieldValue.toString(), + customPropertyType, + propertyConfig); + case "enum" -> + fieldValue = + parseEnumType( + printer, + csvRecord, + fieldNumber, + fieldName, + customPropertyType, + fieldValue, + propertyConfig); + case "timeInterval" -> + fieldValue = parseTimeInterval(printer, csvRecord, fieldNumber, fieldName, fieldValue); + case "number", "integer", "timestamp" -> + fieldValue = + parseLongField( + printer, csvRecord, fieldNumber, fieldName, customPropertyType, fieldValue); + case "table-cp" -> + fieldValue = + parseTableType( + printer, csvRecord, fieldNumber, fieldName, fieldValue, propertyConfig); default -> {} } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/OpenMetadataApplication.java b/openmetadata-service/src/main/java/org/openmetadata/service/OpenMetadataApplication.java index 6ee9faf31f86..d1734bc68603 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/OpenMetadataApplication.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/OpenMetadataApplication.java @@ -947,8 +947,8 @@ private void registerAuthenticator(SecurityConfigurationManager catalogConfig) { case BASIC -> authenticatorHandler = new BasicAuthenticator(); case LDAP -> authenticatorHandler = new LdapAuthenticator(); default -> - // For all other types, google, okta etc. auth is handled externally - authenticatorHandler = new NoopAuthenticator(); + // For all other types, google, okta etc. auth is handled externally + authenticatorHandler = new NoopAuthenticator(); } SecurityConfigurationManager.getInstance().setAuthenticatorHandler(authenticatorHandler); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/distributed/DistributedJobStatsAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/distributed/DistributedJobStatsAggregator.java index bf615966f3b3..bc6bd90535e9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/distributed/DistributedJobStatsAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/distributed/DistributedJobStatsAggregator.java @@ -315,14 +315,15 @@ private void notifyProgressListener( switch (currentStatus) { case COMPLETED -> progressListener.onJobCompleted(stats, elapsedMillis); - case COMPLETED_WITH_ERRORS -> progressListener.onJobCompletedWithErrors( - stats, elapsedMillis); - case FAILED -> progressListener.onJobFailed( - stats, - new RuntimeException( - job.getErrorMessage() != null - ? job.getErrorMessage() - : "Distributed job failed")); + case COMPLETED_WITH_ERRORS -> + progressListener.onJobCompletedWithErrors(stats, elapsedMillis); + case FAILED -> + progressListener.onJobFailed( + stats, + new RuntimeException( + job.getErrorMessage() != null + ? job.getErrorMessage() + : "Distributed job failed")); case STOPPED -> progressListener.onJobStopped(stats); default -> { /* No special notification for other states */ diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/EventSubscriptionScheduler.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/EventSubscriptionScheduler.java index ef03eb60a201..56e94a6fb79f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/EventSubscriptionScheduler.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/EventSubscriptionScheduler.java @@ -617,12 +617,12 @@ public Optional getEventSubscriptionOffset(UUID subscri public int countTotalEvents(UUID id, TypedEvent.Status status) { return switch (status) { - case FAILED -> Entity.getCollectionDAO() - .eventSubscriptionDAO() - .countFailedEventsById(id.toString()); - case SUCCESSFUL -> Entity.getCollectionDAO() - .eventSubscriptionDAO() - .countSuccessfulEventsBySubscriptionId(id.toString()); + case FAILED -> + Entity.getCollectionDAO().eventSubscriptionDAO().countFailedEventsById(id.toString()); + case SUCCESSFUL -> + Entity.getCollectionDAO() + .eventSubscriptionDAO() + .countSuccessfulEventsBySubscriptionId(id.toString()); default -> throw new IllegalArgumentException("Unknown event status: " + status); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/template/DataInsightDescriptionAndOwnerTemplate.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/template/DataInsightDescriptionAndOwnerTemplate.java index a7d1fafac42a..cb88b5e77260 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/template/DataInsightDescriptionAndOwnerTemplate.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/template/DataInsightDescriptionAndOwnerTemplate.java @@ -95,11 +95,14 @@ private String getKpiCriteriaMessage(MetricType metricType, KpiCriteria criteria if (metricType != MetricType.TIER) { if (kpiAvailable) { return switch (criteria) { - case MET -> "Great the Target Set for KPIs has been achieved. It's time to restructure your goals, set new KPIs and progress faster."; - case IN_PROGRESS -> String.format( - "To meet the KPIs you will need a minimum of %s%% %s in the next %s days.", - targetKpi, getMetricTypeMessage(metricType).toLowerCase(), numberOfDaysLeft); - case NOT_MET -> "The Target set for KPIs was not met it’s time to restructure your goals and progress faster."; + case MET -> + "Great the Target Set for KPIs has been achieved. It's time to restructure your goals, set new KPIs and progress faster."; + case IN_PROGRESS -> + String.format( + "To meet the KPIs you will need a minimum of %s%% %s in the next %s days.", + targetKpi, getMetricTypeMessage(metricType).toLowerCase(), numberOfDaysLeft); + case NOT_MET -> + "The Target set for KPIs was not met it’s time to restructure your goals and progress faster."; }; } return "You have not set any KPIs yet, it’s time to restructure your goals, set KPIs and progress faster."; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowInstanceListener.java b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowInstanceListener.java index 158215867995..5b6e68a79422 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowInstanceListener.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowInstanceListener.java @@ -38,11 +38,12 @@ public void execute(DelegateExecution execution) { processInstanceId); updateWorkflowInstance(execution, workflowInstanceRepository); } - default -> LOG.debug( - "[WORKFLOW_INSTANCE_EVENT] Workflow: {}, ProcessInstance: {} - Unsupported event: {}", - workflowName, - processInstanceId, - eventName); + default -> + LOG.debug( + "[WORKFLOW_INSTANCE_EVENT] Workflow: {}, ProcessInstance: {} - Unsupported event: {}", + workflowName, + processInstanceId, + eventName); } } catch (Exception exc) { LOG.error( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowInstanceStageListener.java b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowInstanceStageListener.java index 2d80b6430a18..6bd20d147361 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowInstanceStageListener.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowInstanceStageListener.java @@ -45,12 +45,13 @@ public void execute(DelegateExecution execution) { currentActivity); updateStage(varHandler, execution, workflowInstanceStateRepository); } - default -> LOG.debug( - "[STAGE_EVENT] Workflow: {}, ProcessInstance: {}, Activity: {} - Unsupported event: {}", - workflowName, - processInstanceId, - currentActivity, - eventName); + default -> + LOG.debug( + "[STAGE_EVENT] Workflow: {}, ProcessInstance: {}, Activity: {} - Unsupported event: {}", + workflowName, + processInstanceId, + currentActivity, + eventName); } } catch (Exception exc) { LOG.error( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/NodeFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/NodeFactory.java index 5003cba3d9fa..71a9ef850550 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/NodeFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/NodeFactory.java @@ -50,39 +50,49 @@ public static NodeInterface createNode( return switch (NodeSubType.fromValue(nodeDefinition.getSubType())) { case START_EVENT -> new StartEvent((StartEventDefinition) nodeDefinition, config); case END_EVENT -> new EndEvent((EndEventDefinition) nodeDefinition, config); - case CHECK_ENTITY_ATTRIBUTES_TASK -> new CheckEntityAttributesTask( - (CheckEntityAttributesTaskDefinition) nodeDefinition, config); - case CHECK_CHANGE_DESCRIPTION_TASK -> new CheckChangeDescriptionTask( - (CheckChangeDescriptionTaskDefinition) nodeDefinition, config); - case SET_ENTITY_ATTRIBUTE_TASK -> new SetEntityAttributeTask( - (SetEntityAttributeTaskDefinition) nodeDefinition, config); - case SET_ENTITY_CERTIFICATION_TASK -> new SetEntityCertificationTask( - (SetEntityCertificationTaskDefinition) nodeDefinition, config); - case SET_GLOSSARY_TERM_STATUS_TASK -> new SetGlossaryTermStatusTask( - (SetGlossaryTermStatusTaskDefinition) nodeDefinition, config); - case USER_APPROVAL_TASK -> new UserApprovalTask( - (UserApprovalTaskDefinition) nodeDefinition, - config, - resolveUserApprovalTaskType(workflowDefinitionName), - resolveUserApprovalTaskCategory(workflowDefinitionName)); - case CREATE_AND_RUN_INGESTION_PIPELINE_TASK -> new CreateAndRunIngestionPipelineTask( - (CreateAndRunIngestionPipelineTaskDefinition) nodeDefinition, config); + case CHECK_ENTITY_ATTRIBUTES_TASK -> + new CheckEntityAttributesTask( + (CheckEntityAttributesTaskDefinition) nodeDefinition, config); + case CHECK_CHANGE_DESCRIPTION_TASK -> + new CheckChangeDescriptionTask( + (CheckChangeDescriptionTaskDefinition) nodeDefinition, config); + case SET_ENTITY_ATTRIBUTE_TASK -> + new SetEntityAttributeTask((SetEntityAttributeTaskDefinition) nodeDefinition, config); + case SET_ENTITY_CERTIFICATION_TASK -> + new SetEntityCertificationTask( + (SetEntityCertificationTaskDefinition) nodeDefinition, config); + case SET_GLOSSARY_TERM_STATUS_TASK -> + new SetGlossaryTermStatusTask( + (SetGlossaryTermStatusTaskDefinition) nodeDefinition, config); + case USER_APPROVAL_TASK -> + new UserApprovalTask( + (UserApprovalTaskDefinition) nodeDefinition, + config, + resolveUserApprovalTaskType(workflowDefinitionName), + resolveUserApprovalTaskCategory(workflowDefinitionName)); + case CREATE_AND_RUN_INGESTION_PIPELINE_TASK -> + new CreateAndRunIngestionPipelineTask( + (CreateAndRunIngestionPipelineTaskDefinition) nodeDefinition, config); case RUN_APP_TASK -> new RunAppTask((RunAppTaskDefinition) nodeDefinition, config); - case ROLLBACK_ENTITY_TASK -> new RollbackEntityTask( - (RollbackEntityTaskDefinition) nodeDefinition, config); - case DATA_COMPLETENESS_TASK -> new DataCompletenessTask( - (DataCompletenessTaskDefinition) nodeDefinition, config); - case PARALLEL_GATEWAY -> new ParallelGateway( - (ParallelGatewayDefinition) nodeDefinition, config); + case ROLLBACK_ENTITY_TASK -> + new RollbackEntityTask((RollbackEntityTaskDefinition) nodeDefinition, config); + case DATA_COMPLETENESS_TASK -> + new DataCompletenessTask((DataCompletenessTaskDefinition) nodeDefinition, config); + case PARALLEL_GATEWAY -> + new ParallelGateway((ParallelGatewayDefinition) nodeDefinition, config); case SINK_TASK -> new SinkTask((SinkTaskDefinition) nodeDefinition, config); - case CREATE_RECOGNIZER_FEEDBACK_APPROVAL_TASK -> new CreateRecognizerFeedbackApprovalTask( - (CreateRecognizerFeedbackApprovalTaskDefinition) nodeDefinition, config); - case APPLY_RECOGNIZER_FEEDBACK_TASK -> new ApplyRecognizerFeedbackTask( - (ApplyRecognizerFeedbackTaskDefinition) nodeDefinition, config); - case REJECT_RECOGNIZER_FEEDBACK_TASK -> new RejectRecognizerFeedbackTask( - (RejectRecognizerFeedbackTaskDefinition) nodeDefinition, config); - default -> throw new IllegalArgumentException( - "Unsupported node subtype: " + nodeDefinition.getSubType()); + case CREATE_RECOGNIZER_FEEDBACK_APPROVAL_TASK -> + new CreateRecognizerFeedbackApprovalTask( + (CreateRecognizerFeedbackApprovalTaskDefinition) nodeDefinition, config); + case APPLY_RECOGNIZER_FEEDBACK_TASK -> + new ApplyRecognizerFeedbackTask( + (ApplyRecognizerFeedbackTaskDefinition) nodeDefinition, config); + case REJECT_RECOGNIZER_FEEDBACK_TASK -> + new RejectRecognizerFeedbackTask( + (RejectRecognizerFeedbackTaskDefinition) nodeDefinition, config); + default -> + throw new IllegalArgumentException( + "Unsupported node subtype: " + nodeDefinition.getSubType()); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/TriggerFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/TriggerFactory.java index 11acdf109a91..b87dd4cb3e64 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/TriggerFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/TriggerFactory.java @@ -19,17 +19,20 @@ public static TriggerInterface createTrigger(WorkflowDefinition workflow) { String triggerWorkflowId = getTriggerWorkflowId(workflow.getFullyQualifiedName()); return switch (TriggerType.fromValue(workflow.getTrigger().getType())) { - case EVENT_BASED_ENTITY -> new EventBasedEntityTrigger( - workflow.getName(), - triggerWorkflowId, - (EventBasedEntityTriggerDefinition) workflow.getTrigger()); - case NO_OP -> new NoOpTrigger( - workflow.getName(), triggerWorkflowId, (NoOpTriggerDefinition) workflow.getTrigger()); - case PERIODIC_BATCH_ENTITY -> new PeriodicBatchEntityTrigger( - workflow.getName(), - triggerWorkflowId, - (PeriodicBatchEntityTriggerDefinition) workflow.getTrigger(), - hasBatchModeNodes(workflow)); + case EVENT_BASED_ENTITY -> + new EventBasedEntityTrigger( + workflow.getName(), + triggerWorkflowId, + (EventBasedEntityTriggerDefinition) workflow.getTrigger()); + case NO_OP -> + new NoOpTrigger( + workflow.getName(), triggerWorkflowId, (NoOpTriggerDefinition) workflow.getTrigger()); + case PERIODIC_BATCH_ENTITY -> + new PeriodicBatchEntityTrigger( + workflow.getName(), + triggerWorkflowId, + (PeriodicBatchEntityTriggerDefinition) workflow.getTrigger(), + hasBatchModeNodes(workflow)); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/runApp/RunAppImpl.java b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/runApp/RunAppImpl.java index f44b23db4368..cadd665be22e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/runApp/RunAppImpl.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/runApp/RunAppImpl.java @@ -114,17 +114,20 @@ private Map getConfig(App app, ServiceEntityInterface service) { Object config = JsonUtils.deepCopy(app.getAppConfiguration(), Object.class); switch (app.getName()) { - case "CollateAIApplication" -> config = - (JsonUtils.convertValue(config, CollateAIAppConfig.class)) - .withFilter(getTableServiceFilter(service.getName())) - .withPatchIfEmpty(true); - case "CollateAIQualityAgentApplication" -> config = - (JsonUtils.convertValue(config, CollateAIQualityAgentAppConfig.class)) - .withFilter(getTableServiceFilter(service.getName())); - case "CollateAITierAgentApplication" -> config = - (JsonUtils.convertValue(config, CollateAITierAgentAppConfig.class)) - .withFilter(getTableServiceFilter(service.getName())) - .withPatchIfEmpty(true); + case "CollateAIApplication" -> + config = + (JsonUtils.convertValue(config, CollateAIAppConfig.class)) + .withFilter(getTableServiceFilter(service.getName())) + .withPatchIfEmpty(true); + case "CollateAIQualityAgentApplication" -> + config = + (JsonUtils.convertValue(config, CollateAIQualityAgentAppConfig.class)) + .withFilter(getTableServiceFilter(service.getName())); + case "CollateAITierAgentApplication" -> + config = + (JsonUtils.convertValue(config, CollateAITierAgentAppConfig.class)) + .withFilter(getTableServiceFilter(service.getName())) + .withPatchIfEmpty(true); case "DataInsightsApplication" -> { DataInsightsAppConfig updatedAppConfig = (JsonUtils.convertValue(config, DataInsightsAppConfig.class)); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/util/FieldChangeValueExtractor.java b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/util/FieldChangeValueExtractor.java index fe77b565403d..a94cc0a41d15 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/util/FieldChangeValueExtractor.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/util/FieldChangeValueExtractor.java @@ -28,7 +28,7 @@ public static String extractFqnFromValue(Object value) { return null; } - // FieldChange values are often stored as JSON strings, try to parse first + // FieldChange values are often stored as JSON strings, try to parse first case String strValue -> { String trimmed = strValue.trim(); if (trimmed.startsWith("[") || trimmed.startsWith("{")) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ActivityStreamRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ActivityStreamRepository.java index c4f5b082fc8e..dad43a112e2f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ActivityStreamRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ActivityStreamRepository.java @@ -464,16 +464,19 @@ private String buildSummary( case ENTITY_DELETED -> String.format("Deleted %s: %s", entityType, entityName); case ENTITY_SOFT_DELETED -> String.format("Soft deleted %s: %s", entityType, entityName); case ENTITY_RESTORED -> String.format("Restored %s: %s", entityType, entityName); - case DESCRIPTION_UPDATED -> fieldChange != null - ? String.format("Updated description of %s", entityName) - : String.format("Description updated on %s", entityName); + case DESCRIPTION_UPDATED -> + fieldChange != null + ? String.format("Updated description of %s", entityName) + : String.format("Description updated on %s", entityName); case TAGS_UPDATED -> String.format("Tags updated on %s", entityName); case OWNER_UPDATED -> String.format("Owner changed on %s", entityName); case DOMAIN_UPDATED -> String.format("Domain changed on %s", entityName); case TIER_UPDATED -> String.format("Tier changed on %s", entityName); - case CUSTOM_PROPERTY_UPDATED -> fieldChange != null - ? String.format("Custom property '%s' updated on %s", fieldChange.getName(), entityName) - : String.format("Custom property updated on %s", entityName); + case CUSTOM_PROPERTY_UPDATED -> + fieldChange != null + ? String.format( + "Custom property '%s' updated on %s", fieldChange.getName(), entityName) + : String.format("Custom property updated on %s", entityName); default -> String.format("Updated %s: %s", entityType, entityName); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java index 593ef5b360f9..807e68ad1745 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java @@ -10230,29 +10230,29 @@ public static Settings getSettings(SettingsType configType, String json) { Object value = switch (configType) { case EMAIL_CONFIGURATION -> JsonUtils.readValue(json, SmtpSettings.class); - case OPEN_METADATA_BASE_URL_CONFIGURATION -> JsonUtils.readValue( - json, OpenMetadataBaseUrlConfiguration.class); + case OPEN_METADATA_BASE_URL_CONFIGURATION -> + JsonUtils.readValue(json, OpenMetadataBaseUrlConfiguration.class); case CUSTOM_UI_THEME_PREFERENCE -> JsonUtils.readValue(json, UiThemePreference.class); case LOGIN_CONFIGURATION -> JsonUtils.readValue(json, LoginConfiguration.class); - case SLACK_APP_CONFIGURATION, SLACK_INSTALLER, SLACK_BOT, SLACK_STATE -> JsonUtils - .readValue(json, String.class); + case SLACK_APP_CONFIGURATION, SLACK_INSTALLER, SLACK_BOT, SLACK_STATE -> + JsonUtils.readValue(json, String.class); case PROFILER_CONFIGURATION -> JsonUtils.readValue(json, ProfilerConfiguration.class); case SEARCH_SETTINGS -> JsonUtils.readValue(json, SearchSettings.class); - case ASSET_CERTIFICATION_SETTINGS -> JsonUtils.readValue( - json, AssetCertificationSettings.class); + case ASSET_CERTIFICATION_SETTINGS -> + JsonUtils.readValue(json, AssetCertificationSettings.class); case WORKFLOW_SETTINGS -> JsonUtils.readValue(json, WorkflowSettings.class); case LINEAGE_SETTINGS -> JsonUtils.readValue(json, LineageSettings.class); - case AUTHENTICATION_CONFIGURATION -> JsonUtils.readValue( - json, AuthenticationConfiguration.class); - case AUTHORIZER_CONFIGURATION -> JsonUtils.readValue( - json, AuthorizerConfiguration.class); + case AUTHENTICATION_CONFIGURATION -> + JsonUtils.readValue(json, AuthenticationConfiguration.class); + case AUTHORIZER_CONFIGURATION -> + JsonUtils.readValue(json, AuthorizerConfiguration.class); case ENTITY_RULES_SETTINGS -> JsonUtils.readValue(json, EntityRulesSettings.class); case SCIM_CONFIGURATION -> JsonUtils.readValue(json, ScimConfiguration.class); case OPEN_LINEAGE_SETTINGS -> JsonUtils.readValue(json, OpenLineageSettings.class); case TEAMS_APP_CONFIGURATION -> JsonUtils.readValue(json, TeamsAppConfiguration.class); case MCP_CONFIGURATION -> JsonUtils.readValue(json, MCPConfiguration.class); - case GLOSSARY_TERM_RELATION_SETTINGS -> JsonUtils.readValue( - json, GlossaryTermRelationSettings.class); + case GLOSSARY_TERM_RELATION_SETTINGS -> + JsonUtils.readValue(json, GlossaryTermRelationSettings.class); default -> throw new IllegalArgumentException("Invalid Settings Type " + configType); }; settings.setConfigValue(value); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ColumnRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ColumnRepository.java index bc75c9b27b57..81671ba98c29 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ColumnRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ColumnRepository.java @@ -152,10 +152,12 @@ public Column updateColumnByFQN( String user = securityContext.getUserPrincipal().getName(); return switch (entityType) { - case TABLE -> updateTableColumn( - uriInfo, securityContext, user, columnFQN, updateColumn, parentEntityRef); - case DASHBOARD_DATA_MODEL -> updateDashboardDataModelColumn( - uriInfo, securityContext, user, columnFQN, updateColumn, parentEntityRef); + case TABLE -> + updateTableColumn( + uriInfo, securityContext, user, columnFQN, updateColumn, parentEntityRef); + case DASHBOARD_DATA_MODEL -> + updateDashboardDataModelColumn( + uriInfo, securityContext, user, columnFQN, updateColumn, parentEntityRef); default -> throw new IllegalStateException("Unexpected entity type: " + entityType); }; } @@ -343,8 +345,8 @@ private EntityReference getParentEntityByFQN(String parentFQN, String entityType dataModelRepository.findByName(parentFQN, Include.NON_DELETED); yield dataModel.getEntityReference(); } - default -> throw new IllegalArgumentException( - "Unsupported entity type: %s".formatted(entityType)); + default -> + throw new IllegalArgumentException("Unsupported entity type: %s".formatted(entityType)); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java index dc5cfbcdc366..cc7ffa84ff68 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java @@ -4904,8 +4904,9 @@ private static String getFormattedDateTimeField( LocalTime time = LocalTime.parse(fieldValue, formatter); yield time.format(formatter); } - default -> throw new IllegalArgumentException( - "Unsupported customPropertyType: " + customPropertyType); + default -> + throw new IllegalArgumentException( + "Unsupported customPropertyType: " + customPropertyType); }; } catch (DateTimeParseException e) { throw new IllegalArgumentException( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java index 7cafa093c737..6e480d8f8987 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java @@ -795,7 +795,7 @@ private String getTestSuiteTypeCondition(String tableName) { } return switch (testSuiteType) { - // We'll clean up the executable when we deprecate the /executable endpoints + // We'll clean up the executable when we deprecate the /executable endpoints case "basic", "executable" -> { if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) { yield String.format( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/NotificationTemplateRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/NotificationTemplateRepository.java index 2c700907de0f..059afecc0591 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/NotificationTemplateRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/NotificationTemplateRepository.java @@ -457,8 +457,9 @@ private void sendToDestination( switch (destination.getType()) { case EMAIL -> sendEmailNotification((EmailMessage) message, destination); case SLACK, MS_TEAMS, G_CHAT, WEBHOOK -> sendWebhookNotification(message, destination); - default -> throw new IllegalArgumentException( - "Unsupported destination type: " + destination.getType()); + default -> + throw new IllegalArgumentException( + "Unsupported destination type: " + destination.getType()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SystemRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SystemRepository.java index c1e606f2a210..43cb0431741d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SystemRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SystemRepository.java @@ -740,15 +740,17 @@ private String getEmbeddingConfigurationMessage(OpenMetadataApplicationConfig ap } return switch (provider.toLowerCase()) { - case "djl" -> String.format( - "DJL configuration: embeddingModel: %s", nlpConfig.getDjl().getEmbeddingModel()); - case "bedrock" -> String.format( - "Bedrock configuration: region: %s, embeddingModelId: %s, embeddingDimension %s", - nlpConfig.getBedrock().getAwsConfig() != null - ? nlpConfig.getBedrock().getAwsConfig().getRegion() - : "not configured", - nlpConfig.getBedrock().getEmbeddingModelId(), - nlpConfig.getBedrock().getEmbeddingDimension()); + case "djl" -> + String.format( + "DJL configuration: embeddingModel: %s", nlpConfig.getDjl().getEmbeddingModel()); + case "bedrock" -> + String.format( + "Bedrock configuration: region: %s, embeddingModelId: %s, embeddingDimension %s", + nlpConfig.getBedrock().getAwsConfig() != null + ? nlpConfig.getBedrock().getAwsConfig().getRegion() + : "not configured", + nlpConfig.getBedrock().getEmbeddingModelId(), + nlpConfig.getBedrock().getEmbeddingDimension()); case "openai" -> { String openaiEndpoint = nullOrEmpty(nlpConfig.getOpenai().getEndpoint()) @@ -766,8 +768,9 @@ private String getEmbeddingConfigurationMessage(OpenMetadataApplicationConfig ap nlpConfig.getOpenai().getEmbeddingDimension(), deploymentInfo); } - default -> String.format( - "Unknown provider '%s'. Supported providers: djl, bedrock, openai", provider); + default -> + String.format( + "Unknown provider '%s'. Supported providers: djl, bedrock, openai", provider); }; } catch (Exception e) { LOG.error("Error getting embedding configuration", e); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepository.java index ef5feb5ea58a..bbc9ef6ea9c8 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepository.java @@ -219,8 +219,9 @@ public void storeInternal( return; } } - default -> throw new IllegalArgumentException( - String.format("Invalid status %s", recordEntity.getTestCaseResolutionStatusType())); + default -> + throw new IllegalArgumentException( + String.format("Invalid status %s", recordEntity.getTestCaseResolutionStatusType())); } EntityReference testCaseReference = recordEntity.getTestCaseReference(); recordEntity.withTestCaseReference(null); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java index 469f2da1589b..e3cc6c4be0c2 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java @@ -216,14 +216,19 @@ private void validateProperty(CustomProperty customProperty) { switch (customProperty.getPropertyType().getName()) { case "enum" -> validateEnumConfig(customProperty.getCustomPropertyConfig()); case "table-cp" -> validateTableTypeConfig(customProperty.getCustomPropertyConfig()); - case "date-cp" -> validateDateFormat( - customProperty.getCustomPropertyConfig(), getDateTokens(), "Invalid date format"); - case "dateTime-cp" -> validateDateFormat( - customProperty.getCustomPropertyConfig(), getDateTimeTokens(), "Invalid dateTime format"); - case "time-cp" -> validateDateFormat( - customProperty.getCustomPropertyConfig(), getTimeTokens(), "Invalid time format"); - // hyperlink-cp requires no special config validation - URL protocol validation - // (http/https only) is enforced in EntityRepository.validateHyperlinkUrl + case "date-cp" -> + validateDateFormat( + customProperty.getCustomPropertyConfig(), getDateTokens(), "Invalid date format"); + case "dateTime-cp" -> + validateDateFormat( + customProperty.getCustomPropertyConfig(), + getDateTimeTokens(), + "Invalid dateTime format"); + case "time-cp" -> + validateDateFormat( + customProperty.getCustomPropertyConfig(), getTimeTokens(), "Invalid time format"); + // hyperlink-cp requires no special config validation - URL protocol validation + // (http/https only) is enforced in EntityRepository.validateHyperlinkUrl case "int", "string", "hyperlink-cp" -> {} } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1110/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1110/MigrationUtil.java index 9bd511513e83..a3c441fe23f0 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1110/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1110/MigrationUtil.java @@ -105,10 +105,12 @@ private void updateTagRecognizers( public boolean checkTableExists(Handle handle, String tableName) { String query = switch (connectionType) { - case MYSQL -> "SELECT COUNT(*) FROM information_schema.tables " - + "WHERE table_schema = DATABASE() AND table_name = ?"; - case POSTGRES -> "SELECT COUNT(*) FROM information_schema.tables " - + "WHERE table_schema = current_schema() AND table_name = ?"; + case MYSQL -> + "SELECT COUNT(*) FROM information_schema.tables " + + "WHERE table_schema = DATABASE() AND table_name = ?"; + case POSTGRES -> + "SELECT COUNT(*) FROM information_schema.tables " + + "WHERE table_schema = current_schema() AND table_name = ?"; }; Integer count = handle.createQuery(query).bind(0, tableName).mapTo(Integer.class).one(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1114/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1114/MigrationUtil.java index 61b3d3552f60..24cfa8bc9ab2 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1114/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1114/MigrationUtil.java @@ -342,11 +342,13 @@ SELECT COUNT(*) as cnt FROM entity_relationship private static String getInsertRolePolicyRelationshipQuery(ConnectionType connectionType) { return switch (connectionType) { - case MYSQL -> """ + case MYSQL -> + """ INSERT IGNORE INTO entity_relationship (fromId, toId, fromEntity, toEntity, relation) VALUES (:roleId, :policyId, 'role', 'policy', :relation) """; - case POSTGRES -> """ + case POSTGRES -> + """ INSERT INTO entity_relationship (fromId, toId, fromEntity, toEntity, relation) VALUES (:roleId, :policyId, 'role', 'policy', :relation) ON CONFLICT DO NOTHING @@ -358,12 +360,14 @@ private static String findBotUserId( Handle handle, ConnectionType connectionType, String userName) { String query = switch (connectionType) { - case MYSQL -> """ + case MYSQL -> + """ SELECT id FROM user_entity WHERE JSON_UNQUOTE(JSON_EXTRACT(json, '$.name')) = :name AND JSON_EXTRACT(json, '$.isBot') = true """; - case POSTGRES -> """ + case POSTGRES -> + """ SELECT id FROM user_entity WHERE json->>'name' = :name AND (json->>'isBot')::boolean = true @@ -401,11 +405,13 @@ SELECT COUNT(*) as cnt FROM entity_relationship private static String getInsertUserRoleRelationshipQuery(ConnectionType connectionType) { return switch (connectionType) { - case MYSQL -> """ + case MYSQL -> + """ INSERT IGNORE INTO entity_relationship (fromId, toId, fromEntity, toEntity, relation) VALUES (:userId, :roleId, 'user', 'role', :relation) """; - case POSTGRES -> """ + case POSTGRES -> + """ INSERT INTO entity_relationship (fromId, toId, fromEntity, toEntity, relation) VALUES (:userId, :roleId, 'user', 'role', :relation) ON CONFLICT DO NOTHING @@ -486,7 +492,8 @@ private static int countTable(Handle handle, String tableName) { private static String getAppsWithoutBotRelationshipQuery(ConnectionType connectionType) { return switch (connectionType) { - case MYSQL -> """ + case MYSQL -> + """ SELECT a.id, JSON_UNQUOTE(JSON_EXTRACT(a.json, '$.name')) as name FROM installed_apps a WHERE NOT EXISTS ( @@ -496,7 +503,8 @@ WHERE NOT EXISTS ( AND er.relation = 0 ) """; - case POSTGRES -> """ + case POSTGRES -> + """ SELECT a.id, a.json->>'name' as name FROM installed_apps a WHERE NOT EXISTS ( @@ -511,11 +519,13 @@ WHERE NOT EXISTS ( private static String getFindBotByNameQuery(ConnectionType connectionType) { return switch (connectionType) { - case MYSQL -> """ + case MYSQL -> + """ SELECT id FROM bot_entity WHERE JSON_UNQUOTE(JSON_EXTRACT(json, '$.name')) = :botName """; - case POSTGRES -> """ + case POSTGRES -> + """ SELECT id FROM bot_entity WHERE json->>'name' = :botName """; @@ -524,11 +534,13 @@ WHERE JSON_UNQUOTE(JSON_EXTRACT(json, '$.name')) = :botName private static String getInsertRelationshipQuery(ConnectionType connectionType) { return switch (connectionType) { - case MYSQL -> """ + case MYSQL -> + """ INSERT IGNORE INTO entity_relationship (fromId, toId, fromEntity, toEntity, relation) VALUES (:appId, :botId, 'application', 'bot', :relation) """; - case POSTGRES -> """ + case POSTGRES -> + """ INSERT INTO entity_relationship (fromId, toId, fromEntity, toEntity, relation) VALUES (:appId, :botId, 'application', 'bot', :relation) ON CONFLICT DO NOTHING @@ -605,11 +617,13 @@ private static List findMissingSystemRoles(Handle handle, ConnectionType private static String getCheckPolicyExistsQuery(ConnectionType connectionType) { return switch (connectionType) { - case MYSQL -> """ + case MYSQL -> + """ SELECT COUNT(*) FROM policy_entity WHERE JSON_UNQUOTE(JSON_EXTRACT(json, '$.name')) = :name """; - case POSTGRES -> """ + case POSTGRES -> + """ SELECT COUNT(*) FROM policy_entity WHERE json->>'name' = :name """; @@ -618,11 +632,13 @@ SELECT COUNT(*) FROM policy_entity private static String getCheckRoleExistsQuery(ConnectionType connectionType) { return switch (connectionType) { - case MYSQL -> """ + case MYSQL -> + """ SELECT COUNT(*) FROM role_entity WHERE JSON_UNQUOTE(JSON_EXTRACT(json, '$.name')) = :name """; - case POSTGRES -> """ + case POSTGRES -> + """ SELECT COUNT(*) FROM role_entity WHERE json->>'name' = :name """; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1115/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1115/MigrationUtil.java index bdf298e4a46f..cda80731c0df 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1115/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v1115/MigrationUtil.java @@ -26,14 +26,16 @@ public static void removeDeprecatedSamlAuthorityUrl( String updateQuery = switch (connectionType) { - case MYSQL -> """ + case MYSQL -> + """ UPDATE openmetadata_settings SET json = JSON_REMOVE(json, '$.samlConfiguration.idp.authorityUrl') WHERE configType = 'authenticationConfiguration' AND JSON_CONTAINS_PATH(json, 'one', '$.samlConfiguration.idp.authorityUrl') """; - case POSTGRES -> """ + case POSTGRES -> + """ UPDATE openmetadata_settings SET json = jsonb_set( json::jsonb, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v200/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v200/MigrationUtil.java index 38002f4a837c..a73a9937b841 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v200/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v200/MigrationUtil.java @@ -572,9 +572,8 @@ private static String mapThreadTaskType(String oldType, String entityType) { return switch (oldType) { case "RequestDescription", "UpdateDescription" -> "DescriptionUpdate"; case "RequestTag", "UpdateTag" -> "TagUpdate"; - case "RequestApproval" -> Entity.GLOSSARY_TERM.equals(entityType) - ? "GlossaryApproval" - : "RequestApproval"; + case "RequestApproval" -> + Entity.GLOSSARY_TERM.equals(entityType) ? "GlossaryApproval" : "RequestApproval"; case "RequestTestCaseFailureResolution" -> "TestCaseResolution"; case "RecognizerFeedbackApproval" -> "DataQualityReview"; default -> "CustomTask"; @@ -781,12 +780,14 @@ private static ActivityEventType mapLegacyActivityThreadType( case ENTITY_CREATED -> ActivityEventType.ENTITY_CREATED; case ENTITY_DELETED -> ActivityEventType.ENTITY_DELETED; case ENTITY_SOFT_DELETED -> ActivityEventType.ENTITY_SOFT_DELETED; - case DESCRIPTION -> isNestedFieldActivity(legacyThread.getAbout(), "description") - ? ActivityEventType.COLUMN_DESCRIPTION_UPDATED - : ActivityEventType.DESCRIPTION_UPDATED; - case TAGS -> isNestedFieldActivity(legacyThread.getAbout(), "tags") - ? ActivityEventType.COLUMN_TAGS_UPDATED - : ActivityEventType.TAGS_UPDATED; + case DESCRIPTION -> + isNestedFieldActivity(legacyThread.getAbout(), "description") + ? ActivityEventType.COLUMN_DESCRIPTION_UPDATED + : ActivityEventType.DESCRIPTION_UPDATED; + case TAGS -> + isNestedFieldActivity(legacyThread.getAbout(), "tags") + ? ActivityEventType.COLUMN_TAGS_UPDATED + : ActivityEventType.TAGS_UPDATED; case OWNER -> ActivityEventType.OWNER_UPDATED; case DOMAIN -> ActivityEventType.DOMAIN_UPDATED; case CUSTOM_PROPERTIES -> ActivityEventType.CUSTOM_PROPERTY_UPDATED; @@ -815,9 +816,8 @@ private static ActivityEventType mapFieldNameToActivityEventType(String fieldNam case "owner", "owners" -> ActivityEventType.OWNER_UPDATED; case "domain", "domains" -> ActivityEventType.DOMAIN_UPDATED; case "tier" -> ActivityEventType.TIER_UPDATED; - default -> fieldName.startsWith("extension") - ? ActivityEventType.CUSTOM_PROPERTY_UPDATED - : null; + default -> + fieldName.startsWith("extension") ? ActivityEventType.CUSTOM_PROPERTY_UPDATED : null; }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v201/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v201/MigrationUtil.java index 27f8bb205dfe..2290ac1a5a74 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v201/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v201/MigrationUtil.java @@ -340,16 +340,16 @@ private TypeAndCategory mapLegacyTaskType(TaskType legacyTaskType) { } return switch (legacyTaskType) { - case RequestApproval -> new TypeAndCategory( - TaskEntityType.GlossaryApproval, TaskCategory.Approval); - case RecognizerFeedbackApproval -> new TypeAndCategory( - TaskEntityType.DataQualityReview, TaskCategory.Review); - case RequestDescription, UpdateDescription -> new TypeAndCategory( - TaskEntityType.DescriptionUpdate, TaskCategory.MetadataUpdate); - case RequestTag, UpdateTag -> new TypeAndCategory( - TaskEntityType.TagUpdate, TaskCategory.MetadataUpdate); - case RequestTestCaseFailureResolution -> new TypeAndCategory( - TaskEntityType.TestCaseResolution, TaskCategory.Incident); + case RequestApproval -> + new TypeAndCategory(TaskEntityType.GlossaryApproval, TaskCategory.Approval); + case RecognizerFeedbackApproval -> + new TypeAndCategory(TaskEntityType.DataQualityReview, TaskCategory.Review); + case RequestDescription, UpdateDescription -> + new TypeAndCategory(TaskEntityType.DescriptionUpdate, TaskCategory.MetadataUpdate); + case RequestTag, UpdateTag -> + new TypeAndCategory(TaskEntityType.TagUpdate, TaskCategory.MetadataUpdate); + case RequestTestCaseFailureResolution -> + new TypeAndCategory(TaskEntityType.TestCaseResolution, TaskCategory.Incident); case Generic -> new TypeAndCategory(TaskEntityType.CustomTask, TaskCategory.Custom); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/CloudwatchEventMonitor.java b/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/CloudwatchEventMonitor.java index 895832311e68..406401ebfe8d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/CloudwatchEventMonitor.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/CloudwatchEventMonitor.java @@ -105,12 +105,12 @@ protected List buildMetricRequest(ChangeEvent event) { switch (event.getEventType()) { case ENTITY_CREATED -> List.of(logPipelineCreated(fqn, pipelineType, timestamp)); case ENTITY_UPDATED -> - // we can have multiple updates bundled together - logPipelineUpdated(fqn, pipelineType, timestamp, event.getChangeDescription()); - case ENTITY_DELETED, ENTITY_SOFT_DELETED -> List.of( - logPipelineDeleted(fqn, pipelineType, timestamp)); - default -> throw new IllegalArgumentException( - "Invalid EventType " + event.getEventType()); + // we can have multiple updates bundled together + logPipelineUpdated(fqn, pipelineType, timestamp, event.getChangeDescription()); + case ENTITY_DELETED, ENTITY_SOFT_DELETED -> + List.of(logPipelineDeleted(fqn, pipelineType, timestamp)); + default -> + throw new IllegalArgumentException("Invalid EventType " + event.getEventType()); }; } catch (IllegalArgumentException | CloudWatchException e) { LOG.error("Failed to publish IngestionPipeline Cloudwatch metric due to {}", e.getMessage()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/PrometheusEventMonitor.java b/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/PrometheusEventMonitor.java index b09fde29cb32..7995405529f2 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/PrometheusEventMonitor.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/PrometheusEventMonitor.java @@ -57,23 +57,22 @@ protected void pushMetric(ChangeEvent event) { try { switch (event.getEventType()) { - case ENTITY_DELETED, - ENTITY_SOFT_DELETED, - ENTITY_CREATED -> incrementIngestionPipelineCounter( - fqn, pipelineType, event.getEventType().value()); + case ENTITY_DELETED, ENTITY_SOFT_DELETED, ENTITY_CREATED -> + incrementIngestionPipelineCounter(fqn, pipelineType, event.getEventType().value()); case ENTITY_UPDATED -> - // we can have multiple updates bundled together - event - .getChangeDescription() - .getFieldsUpdated() - .forEach( - change -> { - if (change.getName().equals(PIPELINE_STATUS) && change.getNewValue() != null) { - PipelineStatus pipelineStatus = (PipelineStatus) change.getNewValue(); - incrementIngestionPipelineCounter( - fqn, pipelineType, pipelineStatus.getPipelineState().value()); - } - }); + // we can have multiple updates bundled together + event + .getChangeDescription() + .getFieldsUpdated() + .forEach( + change -> { + if (change.getName().equals(PIPELINE_STATUS) + && change.getNewValue() != null) { + PipelineStatus pipelineStatus = (PipelineStatus) change.getNewValue(); + incrementIngestionPipelineCounter( + fqn, pipelineType, pipelineStatus.getPipelineState().value()); + } + }); default -> throw new IllegalArgumentException("Invalid EventType " + event.getEventType()); } } catch (IllegalArgumentException | CloudWatchException e) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/notifications/template/handlebars/helpers/BuildEntityUrlHelper.java b/openmetadata-service/src/main/java/org/openmetadata/service/notifications/template/handlebars/helpers/BuildEntityUrlHelper.java index 9be128833e3e..427309a85621 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/notifications/template/handlebars/helpers/BuildEntityUrlHelper.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/notifications/template/handlebars/helpers/BuildEntityUrlHelper.java @@ -143,43 +143,43 @@ private String buildEntityUrl(String entityType, String fqn, Map String url = switch (entityType) { case Entity.TEST_CASE -> - // TEST_CASE: /test-case/{fqn}/test-case-results - buildUrl(baseUrl, "test-case", fqn, "test-case-results"); + // TEST_CASE: /test-case/{fqn}/test-case-results + buildUrl(baseUrl, "test-case", fqn, "test-case-results"); case Entity.TEST_SUITE -> - // TEST_SUITE: /test-suites/{fqn} - buildUrl(baseUrl, "test-suites", fqn, ""); + // TEST_SUITE: /test-suites/{fqn} + buildUrl(baseUrl, "test-suites", fqn, ""); case Entity.GLOSSARY_TERM -> - // GLOSSARY_TERM: /glossary/{fqn} - buildUrl(baseUrl, Entity.GLOSSARY, fqn, ""); + // GLOSSARY_TERM: /glossary/{fqn} + buildUrl(baseUrl, Entity.GLOSSARY, fqn, ""); case Entity.TAG -> { // TAG: /tags/{firstPartOfFqn} String tagCategory = fqn.contains(".") ? fqn.split("\\.")[0] : fqn; yield buildUrl(baseUrl, "tags", tagCategory, ""); } case Entity.INGESTION_PIPELINE -> - // INGESTION_PIPELINE: Complex logic depending on pipeline type - buildIngestionPipelineUrl(baseUrl, entityMap); + // INGESTION_PIPELINE: Complex logic depending on pipeline type + buildIngestionPipelineUrl(baseUrl, entityMap); case Entity.DATA_CONTRACT -> - // DATA_CONTRACT: Redirects to the table's contract tab - buildDataContractUrl(baseUrl, entityMap); + // DATA_CONTRACT: Redirects to the table's contract tab + buildDataContractUrl(baseUrl, entityMap); case Entity.QUERY -> - // QUERY: Redirects to the table's queries tab with query parameters - buildQueryUrl(baseUrl, entityMap); + // QUERY: Redirects to the table's queries tab with query parameters + buildQueryUrl(baseUrl, entityMap); case Entity.USER -> - // USER: /users/{fqn} - buildUrl(baseUrl, "users", fqn, ""); + // USER: /users/{fqn} + buildUrl(baseUrl, "users", fqn, ""); case Entity.TEAM -> - // TEAM: /settings/members/teams/{fqn} - buildUrl(baseUrl, "settings/members/teams", fqn, ""); + // TEAM: /settings/members/teams/{fqn} + buildUrl(baseUrl, "settings/members/teams", fqn, ""); case Entity.EVENT_SUBSCRIPTION -> - // EVENT_SUBSCRIPTION: /settings/notifications/alert/{name}/configuration - buildUrl(baseUrl, "settings/notifications/alert", fqn, "configuration"); + // EVENT_SUBSCRIPTION: /settings/notifications/alert/{name}/configuration + buildUrl(baseUrl, "settings/notifications/alert", fqn, "configuration"); case Entity.KPI -> - // KPI: /data-insights/kpi/edit-kpi/{name} - buildUrl(baseUrl, "data-insights/kpi/edit-kpi", fqn, ""); + // KPI: /data-insights/kpi/edit-kpi/{name} + buildUrl(baseUrl, "data-insights/kpi/edit-kpi", fqn, ""); case Entity.TYPE -> - // TYPE: /settings/customProperties/{typeName}s - buildUrl(baseUrl, "settings/customProperties", fqn + "s", ""); + // TYPE: /settings/customProperties/{typeName}s + buildUrl(baseUrl, "settings/customProperties", fqn + "s", ""); case Entity.DATABASE_SERVICE, Entity.MESSAGING_SERVICE, Entity.DASHBOARD_SERVICE, @@ -197,8 +197,8 @@ private String buildEntityUrl(String entityType, String fqn, Map yield buildUrl(baseUrl, "service/" + pluralServiceType, fqn, ""); } default -> - // DEFAULT: /{entityType}/{fqn} - buildUrl(baseUrl, entityType, fqn, ""); + // DEFAULT: /{entityType}/{fqn} + buildUrl(baseUrl, entityType, fqn, ""); }; LOG.debug("Built entity URL for type={}, fqn={}: {}", entityType, fqn, url); @@ -245,16 +245,16 @@ private String buildIngestionPipelineUrl(String baseUrl, Map ent String pipelineType = getTrimmed(entityMap, KEY_PIPELINE_TYPE).orElse(""); return switch (PipelineType.fromValue(pipelineType)) { case TEST_SUITE -> - // TEST_SUITE: redirect to the source table's profiler tab - buildUrl( - baseUrl, - "table", - serviceFqn.replaceFirst("\\.testSuite$", ""), - "profiler?activeTab=Data%20Quality"); + // TEST_SUITE: redirect to the source table's profiler tab + buildUrl( + baseUrl, + "table", + serviceFqn.replaceFirst("\\.testSuite$", ""), + "profiler?activeTab=Data%20Quality"); case APPLICATION -> - // APPLICATION: /automations/{serviceFqn}/automator-details - buildUrl(baseUrl, "automations", serviceFqn, "automator-details"); + // APPLICATION: /automations/{serviceFqn}/automator-details + buildUrl(baseUrl, "automations", serviceFqn, "automator-details"); default -> { // DEFAULT: /service/{serviceType}s/{serviceFqn}/ingestions diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/notifications/template/handlebars/helpers/MathHelper.java b/openmetadata-service/src/main/java/org/openmetadata/service/notifications/template/handlebars/helpers/MathHelper.java index 9910362670c5..678bb76922dd 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/notifications/template/handlebars/helpers/MathHelper.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/notifications/template/handlebars/helpers/MathHelper.java @@ -65,8 +65,8 @@ public void register(Handlebars handlebars) { bd = bd.setScale(decimalPlaces, RoundingMode.HALF_UP); yield bd.doubleValue(); } - default -> throw new IllegalArgumentException( - "Unsupported operator: " + operator); + default -> + throw new IllegalArgumentException("Unsupported operator: " + operator); }; // Return as integer if no decimal part, otherwise as double diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java index 7a21acfe33d7..47cd3dee624d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java @@ -301,8 +301,8 @@ private Property getRelationshipPredicate(String relationshipType, Model model) case "testedby" -> model.createProperty("https://open-metadata.org/ontology/", "testedBy"); case "upstream" -> model.createProperty("http://www.w3.org/ns/prov#", "wasDerivedFrom"); case "downstream" -> model.createProperty("http://www.w3.org/ns/prov#", "wasInfluencedBy"); - case "joinedwith" -> model.createProperty( - "https://open-metadata.org/ontology/", "joinedWith"); + case "joinedwith" -> + model.createProperty("https://open-metadata.org/ontology/", "joinedWith"); case "processedby" -> model.createProperty("http://www.w3.org/ns/prov#", "wasGeneratedBy"); default -> model.createProperty("https://open-metadata.org/ontology/", relationshipType); }; @@ -678,12 +678,12 @@ public String executeSparqlQueryWithInference( // Convert inference level string to enum org.openmetadata.service.rdf.reasoning.InferenceEngine.ReasoningLevel level = switch (inferenceLevel.toLowerCase()) { - case "rdfs" -> org.openmetadata.service.rdf.reasoning.InferenceEngine.ReasoningLevel - .RDFS; - case "owl" -> org.openmetadata.service.rdf.reasoning.InferenceEngine.ReasoningLevel - .OWL_LITE; - case "custom" -> org.openmetadata.service.rdf.reasoning.InferenceEngine.ReasoningLevel - .CUSTOM; + case "rdfs" -> + org.openmetadata.service.rdf.reasoning.InferenceEngine.ReasoningLevel.RDFS; + case "owl" -> + org.openmetadata.service.rdf.reasoning.InferenceEngine.ReasoningLevel.OWL_LITE; + case "custom" -> + org.openmetadata.service.rdf.reasoning.InferenceEngine.ReasoningLevel.CUSTOM; default -> org.openmetadata.service.rdf.reasoning.InferenceEngine.ReasoningLevel.NONE; }; @@ -1548,9 +1548,9 @@ private String formatRelationshipLabel(String relationship) { case "hasstoredprocedure" -> "Has Stored Procedure"; case "hasindex" -> "Has Index"; default -> - // Convert camelCase to Title Case - relationship.replaceAll("([a-z])([A-Z])", "$1 $2").substring(0, 1).toUpperCase() - + relationship.replaceAll("([a-z])([A-Z])", "$1 $2").substring(1); + // Convert camelCase to Title Case + relationship.replaceAll("([a-z])([A-Z])", "$1 $2").substring(0, 1).toUpperCase() + + relationship.replaceAll("([a-z])([A-Z])", "$1 $2").substring(1); }; } @@ -2623,8 +2623,8 @@ private Property getSkosRelationProperty(String relationType, Model model) { case "broader" -> model.createProperty("http://www.w3.org/2004/02/skos/core#", "broader"); case "narrower" -> model.createProperty("http://www.w3.org/2004/02/skos/core#", "narrower"); case "synonym" -> model.createProperty("http://www.w3.org/2004/02/skos/core#", "exactMatch"); - case "relatedto", "related" -> model.createProperty( - "http://www.w3.org/2004/02/skos/core#", "related"); + case "relatedto", "related" -> + model.createProperty("http://www.w3.org/2004/02/skos/core#", "related"); case "seealso" -> model.createProperty("http://www.w3.org/2000/01/rdf-schema#", "seeAlso"); default -> { try { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfUtils.java b/openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfUtils.java index deb1378a044d..fcdcadd2ad25 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfUtils.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfUtils.java @@ -20,18 +20,19 @@ public static String getRdfType(String entityType) { case "glossaryterm", "tag" -> "skos:Concept"; case "classification", "glossary" -> "skos:ConceptScheme"; case "databaseservice", - "dashboardservice", - "messagingservice", - "pipelineservice", - "mlmodelservice", - "storageservice", - "searchservice", - "metadataservice", - "apiservice", - "reportingservice", - "qualityservice", - "observabilityservice", - "driveservice" -> "dcat:DataService"; + "dashboardservice", + "messagingservice", + "pipelineservice", + "mlmodelservice", + "storageservice", + "searchservice", + "metadataservice", + "apiservice", + "reportingservice", + "qualityservice", + "observabilityservice", + "driveservice" -> + "dcat:DataService"; case "role" -> "foaf:Group"; case "bot" -> "foaf:Agent"; case "policy" -> "om:Policy"; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/rdf/translator/JsonLdTranslator.java b/openmetadata-service/src/main/java/org/openmetadata/service/rdf/translator/JsonLdTranslator.java index 310e55e25ad0..bb957115b56d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/rdf/translator/JsonLdTranslator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/rdf/translator/JsonLdTranslator.java @@ -262,66 +262,71 @@ public String toJsonLdString(EntityInterface entity, boolean prettyPrint) throws private Object selectContext(String entityType) { return switch (entityType.toLowerCase()) { case "table", - "database", - "databaseschema", - "storedprocedure", - "query", - "dashboard", - "chart", - "report", - "pipeline", - "topic", - "mlmodel", - "container", - "metric", - "searchindex", - "apicollection", - "apiendpoint", - "directory", - "file", - "spreadsheet", - "worksheet" -> contextCache.get("dataAsset-complete"); + "database", + "databaseschema", + "storedprocedure", + "query", + "dashboard", + "chart", + "report", + "pipeline", + "topic", + "mlmodel", + "container", + "metric", + "searchindex", + "apicollection", + "apiendpoint", + "directory", + "file", + "spreadsheet", + "worksheet" -> + contextCache.get("dataAsset-complete"); case "databaseservice", - "dashboardservice", - "messagingservice", - "pipelineservice", - "mlmodelservice", - "storageservice", - "searchservice", - "metadataservice", - "apiservice", - "reportingservice", - "qualityservice", - "observabilityservice", - "driveservice" -> contextCache.get("service"); + "dashboardservice", + "messagingservice", + "pipelineservice", + "mlmodelservice", + "storageservice", + "searchservice", + "metadataservice", + "apiservice", + "reportingservice", + "qualityservice", + "observabilityservice", + "driveservice" -> + contextCache.get("service"); case "user", "team", "role", "bot", "policy" -> contextCache.get("team"); case "thread", "post" -> contextCache.get("thread"); case "glossary", - "glossaryterm", - "classification", - "tag", - "datacontract", - "dataproduct", - "domain", - "persona" -> contextCache.get("governance"); + "glossaryterm", + "classification", + "tag", + "datacontract", + "dataproduct", + "domain", + "persona" -> + contextCache.get("governance"); case "testdefinition", - "testsuite", - "testcase", - "testcaseresult", - "testcaseresolutionstatus" -> contextCache.get("quality"); + "testsuite", + "testcase", + "testcaseresult", + "testcaseresolutionstatus" -> + contextCache.get("quality"); case "ingestionpipeline", - "workflow", - "workflowdefinition", - "workflowinstance", - "workflowinstancestate", - "eventsubscription", - "kpi", - "datainsightchart", - "webanalyticevent", - "app", - "appmarketplacedefinition", - "document", - "page" -> contextCache.get("operations"); + "workflow", + "workflowdefinition", + "workflowinstance", + "workflowinstancestate", + "eventsubscription", + "kpi", + "datainsightchart", + "webanalyticevent", + "app", + "appmarketplacedefinition", + "document", + "page" -> + contextCache.get("operations"); default -> contextCache.get("base"); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/rdf/translator/RdfPropertyMapper.java b/openmetadata-service/src/main/java/org/openmetadata/service/rdf/translator/RdfPropertyMapper.java index 810b6cb5d3e5..c55050fd1791 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/rdf/translator/RdfPropertyMapper.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/rdf/translator/RdfPropertyMapper.java @@ -1039,21 +1039,23 @@ private XSDDatatype getXSDDatatype(String type) { private String getContextName(String entityType) { return switch (entityType.toLowerCase()) { case "table", - "database", - "databaseschema", - "pipeline", - "topic", - "dashboard", - "chart", - "mlmodel", - "container", - "report" -> "dataAsset-complete"; + "database", + "databaseschema", + "pipeline", + "topic", + "dashboard", + "chart", + "mlmodel", + "container", + "report" -> + "dataAsset-complete"; case "databaseservice", - "dashboardservice", - "messagingservice", - "pipelineservice", - "mlmodelservice", - "storageservice" -> "service"; + "dashboardservice", + "messagingservice", + "pipelineservice", + "mlmodelservice", + "storageservice" -> + "service"; case "user", "team", "role" -> "team"; case "glossary", "glossaryterm", "tag", "classification" -> "governance"; default -> "base"; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java index e0c0c53353a3..1a2c48b00e63 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/events/subscription/EventSubscriptionResource.java @@ -1635,11 +1635,14 @@ private List fetchEvents( UUID id, int limit, int paginationOffset, TypedEvent.Status status) { List events; switch (status) { - case FAILED -> events = - EventSubscriptionScheduler.getInstance().getFailedEventsById(id, limit, paginationOffset); - case SUCCESSFUL -> events = - EventSubscriptionScheduler.getInstance() - .getSuccessfullySentChangeEventsForAlert(id, limit, paginationOffset); + case FAILED -> + events = + EventSubscriptionScheduler.getInstance() + .getFailedEventsById(id, limit, paginationOffset); + case SUCCESSFUL -> + events = + EventSubscriptionScheduler.getInstance() + .getSuccessfullySentChangeEventsForAlert(id, limit, paginationOffset); default -> throw new IllegalArgumentException("Unknown event status: " + status); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/rdf/RdfResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/rdf/RdfResource.java index a07e26176622..22eb8168397a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/rdf/RdfResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/rdf/RdfResource.java @@ -592,8 +592,9 @@ private String buildLineageQuery( String entityUri = normalizedBaseUri + "entity/" + entityType + "/" + entityId; return switch (direction.toLowerCase()) { - case "upstream" -> String.format( - """ + case "upstream" -> + String.format( + """ PREFIX om: SELECT DISTINCT ?entity ?name ?type ?distance WHERE { @@ -604,10 +605,11 @@ private String buildLineageQuery( } ORDER BY ?distance ?name """, - entityUri); + entityUri); - case "downstream" -> String.format( - """ + case "downstream" -> + String.format( + """ PREFIX om: SELECT DISTINCT ?entity ?name ?type ?distance WHERE { @@ -618,10 +620,11 @@ private String buildLineageQuery( } ORDER BY ?distance ?name """, - entityUri); + entityUri); - default -> String.format( - """ + default -> + String.format( + """ PREFIX om: SELECT DISTINCT ?entity ?name ?type ?relationship WHERE { @@ -637,7 +640,7 @@ private String buildLineageQuery( } ORDER BY ?relationship ?name """, - entityUri, entityUri); + entityUri, entityUri); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/settings/SettingsCache.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/settings/SettingsCache.java index d7f518a292a5..ea5be3827e8b 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/settings/SettingsCache.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/settings/SettingsCache.java @@ -641,8 +641,8 @@ static class SettingsLoader extends CacheLoader { } LOG.info("Loaded Email Setting"); } - case OPEN_METADATA_BASE_URL_CONFIGURATION -> fetchedSettings = - Entity.getSystemRepository().getOMBaseUrlConfigInternal(); + case OPEN_METADATA_BASE_URL_CONFIGURATION -> + fetchedSettings = Entity.getSystemRepository().getOMBaseUrlConfigInternal(); case SLACK_APP_CONFIGURATION -> { // Only if available fetchedSettings = Entity.getSystemRepository().getSlackApplicationConfigInternal(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tasks/TaskResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tasks/TaskResource.java index 06516a802dbf..8a249dedb534 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tasks/TaskResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tasks/TaskResource.java @@ -852,14 +852,14 @@ private ListFilter buildCountFilter( } } } - case COUNT_VIEW_ASSIGNED -> filter.addQueryParam( - "assigneeIds", getCurrentUserAssigneeIds(securityContext)); - case COUNT_VIEW_OWNED -> filter.addQueryParam( - "ownedByIds", getCurrentUserOwnedIds(uriInfo, securityContext)); - case COUNT_VIEW_CREATED -> filter.addQueryParam( - "createdById", getCurrentUserId(securityContext)); - case COUNT_VIEW_MENTIONED -> filter.addQueryParam( - "mentionedUser", getCurrentUserMentionedFqn(securityContext)); + case COUNT_VIEW_ASSIGNED -> + filter.addQueryParam("assigneeIds", getCurrentUserAssigneeIds(securityContext)); + case COUNT_VIEW_OWNED -> + filter.addQueryParam("ownedByIds", getCurrentUserOwnedIds(uriInfo, securityContext)); + case COUNT_VIEW_CREATED -> + filter.addQueryParam("createdById", getCurrentUserId(securityContext)); + case COUNT_VIEW_MENTIONED -> + filter.addQueryParam("mentionedUser", getCurrentUserMentionedFqn(securityContext)); case COUNT_VIEW_ENTITY -> { // aboutEntity is applied below when present. } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexFactory.java index 1af43d6f4ca6..0478f43c46f9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexFactory.java @@ -148,8 +148,8 @@ public SearchIndex buildIndex(String entityType, Object entity) { case Entity.SEARCH_SERVICE -> new SearchServiceIndex((SearchService) entity); case Entity.SECURITY_SERVICE -> new SecurityServiceIndex((SecurityService) entity); case Entity.API_SERVICE -> new APIServiceIndex((ApiService) entity); - case Entity.SEARCH_INDEX -> new SearchEntityIndex( - (org.openmetadata.schema.entity.data.SearchIndex) entity); + case Entity.SEARCH_INDEX -> + new SearchEntityIndex((org.openmetadata.schema.entity.data.SearchIndex) entity); case Entity.PIPELINE_SERVICE -> new PipelineServiceIndex((PipelineService) entity); case Entity.STORAGE_SERVICE -> new StorageServiceIndex((StorageService) entity); case Entity.DRIVE_SERVICE -> new DriveServiceIndex((DriveService) entity); @@ -162,17 +162,16 @@ public SearchIndex buildIndex(String entityType, Object entity) { case Entity.DATA_PRODUCT -> new DataProductIndex((DataProduct) entity); case Entity.METADATA_SERVICE -> new MetadataServiceIndex((MetadataService) entity); case Entity.ENTITY_REPORT_DATA -> new EntityReportDataIndex((ReportData) entity); - case Entity.WEB_ANALYTIC_ENTITY_VIEW_REPORT_DATA -> new WebAnalyticEntityViewReportDataIndex( - (ReportData) entity); - case Entity - .WEB_ANALYTIC_USER_ACTIVITY_REPORT_DATA -> new WebAnalyticUserActivityReportDataIndex( - (ReportData) entity); - case Entity.RAW_COST_ANALYSIS_REPORT_DATA -> new RawCostAnalysisReportDataIndex( - (ReportData) entity); - case Entity.AGGREGATED_COST_ANALYSIS_REPORT_DATA -> new AggregatedCostAnalysisReportDataIndex( - (ReportData) entity); - case Entity.TEST_CASE_RESOLUTION_STATUS -> new TestCaseResolutionStatusIndex( - (TestCaseResolutionStatus) entity); + case Entity.WEB_ANALYTIC_ENTITY_VIEW_REPORT_DATA -> + new WebAnalyticEntityViewReportDataIndex((ReportData) entity); + case Entity.WEB_ANALYTIC_USER_ACTIVITY_REPORT_DATA -> + new WebAnalyticUserActivityReportDataIndex((ReportData) entity); + case Entity.RAW_COST_ANALYSIS_REPORT_DATA -> + new RawCostAnalysisReportDataIndex((ReportData) entity); + case Entity.AGGREGATED_COST_ANALYSIS_REPORT_DATA -> + new AggregatedCostAnalysisReportDataIndex((ReportData) entity); + case Entity.TEST_CASE_RESOLUTION_STATUS -> + new TestCaseResolutionStatusIndex((TestCaseResolutionStatus) entity); case Entity.TEST_CASE_RESULT -> new TestCaseResultIndex((TestCaseResult) entity); case Entity.PIPELINE_EXECUTION -> { PipelineExecutionIndex.PipelineExecutionData data = diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexUtils.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexUtils.java index e1b2fb35887f..624a517c6f9a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexUtils.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexUtils.java @@ -329,8 +329,8 @@ private static void traverseAggregationResults( s -> { switch (s.getValueType()) { case NUMBER -> nodeData.put(dimensions.get(0), String.valueOf(s)); - default -> nodeData.put( - dimensions.get(0), ((JsonString) s).getString()); + default -> + nodeData.put(dimensions.get(0), ((JsonString) s).getString()); } }, () -> nodeData.put(dimensions.get(0), null)); @@ -723,17 +723,17 @@ private static List> buildTypedPropertyEntries( case "integer", "number" -> entries.add(buildNumericEntry(propertyName, propertyType, value)); case "timestamp" -> entries.add(buildTimestampEntry(propertyName, propertyType, value)); case "timeInterval" -> entries.add(buildTimeIntervalEntry(propertyName, propertyType, value)); - case "date-cp", "dateTime-cp", "time-cp" -> entries.add( - buildDateStringEntry(propertyName, propertyType, value)); - case "entityReference" -> entries.add( - buildEntityReferenceEntry(propertyName, propertyType, value)); - case "entityReferenceList" -> entries.addAll( - buildEntityReferenceListEntries(propertyName, propertyType, value)); + case "date-cp", "dateTime-cp", "time-cp" -> + entries.add(buildDateStringEntry(propertyName, propertyType, value)); + case "entityReference" -> + entries.add(buildEntityReferenceEntry(propertyName, propertyType, value)); + case "entityReferenceList" -> + entries.addAll(buildEntityReferenceListEntries(propertyName, propertyType, value)); case "enum" -> entries.addAll(buildEnumEntries(propertyName, propertyType, value)); case "markdown", "sqlQuery" -> entries.add(buildTextEntry(propertyName, propertyType, value)); case "table-cp" -> entries.addAll(buildTableEntries(propertyName, propertyType, value)); - case "hyperlink-cp" -> entries.addAll( - buildHyperlinkEntries(propertyName, propertyType, value)); + case "hyperlink-cp" -> + entries.addAll(buildHyperlinkEntries(propertyName, propertyType, value)); default -> entries.add(buildStringEntry(propertyName, propertyType, value)); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchListFilter.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchListFilter.java index 708517424644..fa600cc73b5e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchListFilter.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchListFilter.java @@ -369,8 +369,9 @@ private String getTestSuiteIdCondition(String testSuiteId) { private String getTestCaseTypeCondition(String type, String field) { return switch (type) { - case Entity.TABLE -> String.format( - "{\"bool\": {\"must_not\": [{\"regexp\": {\"%s\": \".*::columns::.*\"}}]}}", field); + case Entity.TABLE -> + String.format( + "{\"bool\": {\"must_not\": [{\"regexp\": {\"%s\": \".*::columns::.*\"}}]}}", field); case "column" -> String.format("{\"regexp\": {\"%s\": \".*::columns::.*\"}}", field); default -> ""; }; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java index 3db14f3bccab..ba21df1b6d19 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java @@ -2093,18 +2093,22 @@ private void appendUpdateScript( private List resolveEntityReferenceList( String fieldName, EntityInterface entity) { return switch (fieldName) { - case "owners" -> entity.getOwners() != null - ? JsonUtils.deepCopyList(entity.getOwners(), EntityReference.class) - : List.of(); - case "domains" -> entity.getDomains() != null - ? JsonUtils.deepCopyList(entity.getDomains(), EntityReference.class) - : List.of(); - case "dataProducts" -> entity.getDataProducts() != null - ? JsonUtils.deepCopyList(entity.getDataProducts(), EntityReference.class) - : List.of(); - case "followers" -> entity.getFollowers() != null - ? JsonUtils.deepCopyList(entity.getFollowers(), EntityReference.class) - : List.of(); + case "owners" -> + entity.getOwners() != null + ? JsonUtils.deepCopyList(entity.getOwners(), EntityReference.class) + : List.of(); + case "domains" -> + entity.getDomains() != null + ? JsonUtils.deepCopyList(entity.getDomains(), EntityReference.class) + : List.of(); + case "dataProducts" -> + entity.getDataProducts() != null + ? JsonUtils.deepCopyList(entity.getDataProducts(), EntityReference.class) + : List.of(); + case "followers" -> + entity.getFollowers() != null + ? JsonUtils.deepCopyList(entity.getFollowers(), EntityReference.class) + : List.of(); default -> List.of(); }; } @@ -2406,19 +2410,21 @@ public void deleteOrUpdateChildren(EntityInterface entity, IndexMapping indexMap indexMapping.getChildAliases(clusterAlias), List.of(new ImmutablePair<>(entityType + ".id", docId))); } - case Entity.DATA_PRODUCT -> searchClient.updateChildren( - GLOBAL_SEARCH_ALIAS, - new ImmutablePair<>("dataProducts.id", docId), - new ImmutablePair<>( - REMOVE_DATA_PRODUCTS_CHILDREN_SCRIPT, - Collections.singletonMap("fqn", entity.getFullyQualifiedName()))); + case Entity.DATA_PRODUCT -> + searchClient.updateChildren( + GLOBAL_SEARCH_ALIAS, + new ImmutablePair<>("dataProducts.id", docId), + new ImmutablePair<>( + REMOVE_DATA_PRODUCTS_CHILDREN_SCRIPT, + Collections.singletonMap("fqn", entity.getFullyQualifiedName()))); - case Entity.TAG, Entity.GLOSSARY_TERM -> searchClient.updateChildren( - GLOBAL_SEARCH_ALIAS, - new ImmutablePair<>("tags.tagFQN", entity.getFullyQualifiedName()), - new ImmutablePair<>( - REMOVE_TAGS_CHILDREN_SCRIPT, - Collections.singletonMap("fqn", entity.getFullyQualifiedName()))); + case Entity.TAG, Entity.GLOSSARY_TERM -> + searchClient.updateChildren( + GLOBAL_SEARCH_ALIAS, + new ImmutablePair<>("tags.tagFQN", entity.getFullyQualifiedName()), + new ImmutablePair<>( + REMOVE_TAGS_CHILDREN_SCRIPT, + Collections.singletonMap("fqn", entity.getFullyQualifiedName()))); case Entity.TEST_SUITE -> { TestSuite testSuite = (TestSuite) entity; if (Boolean.TRUE.equals(testSuite.getBasic())) { @@ -2435,16 +2441,17 @@ public void deleteOrUpdateChildren(EntityInterface entity, IndexMapping indexMap } } case Entity.DASHBOARD_SERVICE, - Entity.DATABASE_SERVICE, - Entity.MESSAGING_SERVICE, - Entity.PIPELINE_SERVICE, - Entity.MLMODEL_SERVICE, - Entity.STORAGE_SERVICE, - Entity.SEARCH_SERVICE, - Entity.SECURITY_SERVICE, - Entity.DRIVE_SERVICE -> searchClient.deleteEntityByFields( - indexMapping.getChildAliases(clusterAlias), - List.of(new ImmutablePair<>("service.id", docId))); + Entity.DATABASE_SERVICE, + Entity.MESSAGING_SERVICE, + Entity.PIPELINE_SERVICE, + Entity.MLMODEL_SERVICE, + Entity.STORAGE_SERVICE, + Entity.SEARCH_SERVICE, + Entity.SECURITY_SERVICE, + Entity.DRIVE_SERVICE -> + searchClient.deleteEntityByFields( + indexMapping.getChildAliases(clusterAlias), + List.of(new ImmutablePair<>("service.id", docId))); default -> { List indexNames = indexMapping.getChildAliases(clusterAlias); if (!indexNames.isEmpty()) { @@ -2463,17 +2470,18 @@ public void softDeleteOrRestoredChildren( String scriptTxt = String.format(SOFT_DELETE_RESTORE_SCRIPT, delete); switch (entityType) { case Entity.DASHBOARD_SERVICE, - Entity.DATABASE_SERVICE, - Entity.MESSAGING_SERVICE, - Entity.PIPELINE_SERVICE, - Entity.MLMODEL_SERVICE, - Entity.STORAGE_SERVICE, - Entity.SEARCH_SERVICE, - Entity.SECURITY_SERVICE, - Entity.DRIVE_SERVICE -> searchClient.softDeleteOrRestoreChildren( - indexMapping.getChildAliases(clusterAlias), - scriptTxt, - List.of(new ImmutablePair<>("service.id", docId))); + Entity.DATABASE_SERVICE, + Entity.MESSAGING_SERVICE, + Entity.PIPELINE_SERVICE, + Entity.MLMODEL_SERVICE, + Entity.STORAGE_SERVICE, + Entity.SEARCH_SERVICE, + Entity.SECURITY_SERVICE, + Entity.DRIVE_SERVICE -> + searchClient.softDeleteOrRestoreChildren( + indexMapping.getChildAliases(clusterAlias), + scriptTxt, + List.of(new ImmutablePair<>("service.id", docId))); default -> { List indexNames = indexMapping.getChildAliases(clusterAlias); if (!indexNames.isEmpty()) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchSourceBuilderFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchSourceBuilderFactory.java index 104dbb321f79..66ae86714a87 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchSourceBuilderFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchSourceBuilderFactory.java @@ -113,10 +113,8 @@ default S getSearchSourceBuilder( } return switch (indexName) { - case "user_search_index", - "user", - "team_search_index", - "team" -> buildUserOrTeamSearchBuilderV2(searchQuery, fromOffset, size); + case "user_search_index", "user", "team_search_index", "team" -> + buildUserOrTeamSearchBuilderV2(searchQuery, fromOffset, size); default -> buildAggregateSearchBuilderV2(searchQuery, fromOffset, size, includeAggregations); }; } @@ -151,21 +149,18 @@ default S buildAggregateSearchBuilderV2(String query, int from, int size) { default S buildTimeSeriesSearchBuilderV2(String indexName, String query, int from, int size) { return switch (indexName) { case "test_case_result_search_index" -> buildTestCaseResultSearchV2(query, from, size); - case "test_case_resolution_status_search_index" -> buildTestCaseResolutionStatusSearchV2( - query, from, size); - case "raw_cost_analysis_report_data_index", - "aggregated_cost_analysis_report_data_index" -> buildCostAnalysisReportDataSearchV2( - query, from, size); + case "test_case_resolution_status_search_index" -> + buildTestCaseResolutionStatusSearchV2(query, from, size); + case "raw_cost_analysis_report_data_index", "aggregated_cost_analysis_report_data_index" -> + buildCostAnalysisReportDataSearchV2(query, from, size); default -> buildAggregateSearchBuilderV2(query, from, size); }; } default S buildDataQualitySearchBuilderV2(String indexName, String query, int from, int size) { return switch (indexName) { - case "test_case_search_index", - "testCase", - "test_suite_search_index", - "testSuite" -> buildTestCaseSearchV2(query, from, size); + case "test_case_search_index", "testCase", "test_suite_search_index", "testSuite" -> + buildTestCaseSearchV2(query, from, size); default -> buildAggregateSearchBuilderV2(query, from, size); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchUtils.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchUtils.java index 0093bf3e9616..5fd87463042f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchUtils.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchUtils.java @@ -398,53 +398,54 @@ public static Set getEntityRelationshipDirection(EntityRelationshipDirec public static boolean isDataAssetIndex(String indexName) { return switch (indexName) { case "topic_search_index", - Entity.TOPIC, - "dashboard_search_index", - Entity.DASHBOARD, - "pipeline_search_index", - Entity.PIPELINE, - "mlmodel_search_index", - Entity.MLMODEL, - "table_search_index", - Entity.TABLE, - "database_schema_search_index", - Entity.DATABASE_SCHEMA, - "database_search_index", - Entity.DATABASE, - "container_search_index", - Entity.CONTAINER, - "query_search_index", - Entity.QUERY, - "stored_procedure_search_index", - Entity.STORED_PROCEDURE, - "dashboard_data_model_search_index", - Entity.DASHBOARD_DATA_MODEL, - "data_product_search_index", - Entity.DATA_PRODUCT, - "domain_search_index", - Entity.DOMAIN, - "glossary_term_search_index", - Entity.GLOSSARY_TERM, - "glossary_search_index", - Entity.GLOSSARY, - "tag_search_index", - Entity.TAG, - "search_entity_search_index", - Entity.SEARCH_INDEX, - "api_collection_search_index", - Entity.API_COLLECTION, - "api_endpoint_search_index", - Entity.API_ENDPOINT, - "directory_search_index", - Entity.DIRECTORY, - "worksheet_search_index", - Entity.WORKSHEET, - "spreadsheet_search_index", - Entity.SPREADSHEET, - "file_search_index", - Entity.FILE, - "metric_search_index", - Entity.METRIC -> true; + Entity.TOPIC, + "dashboard_search_index", + Entity.DASHBOARD, + "pipeline_search_index", + Entity.PIPELINE, + "mlmodel_search_index", + Entity.MLMODEL, + "table_search_index", + Entity.TABLE, + "database_schema_search_index", + Entity.DATABASE_SCHEMA, + "database_search_index", + Entity.DATABASE, + "container_search_index", + Entity.CONTAINER, + "query_search_index", + Entity.QUERY, + "stored_procedure_search_index", + Entity.STORED_PROCEDURE, + "dashboard_data_model_search_index", + Entity.DASHBOARD_DATA_MODEL, + "data_product_search_index", + Entity.DATA_PRODUCT, + "domain_search_index", + Entity.DOMAIN, + "glossary_term_search_index", + Entity.GLOSSARY_TERM, + "glossary_search_index", + Entity.GLOSSARY, + "tag_search_index", + Entity.TAG, + "search_entity_search_index", + Entity.SEARCH_INDEX, + "api_collection_search_index", + Entity.API_COLLECTION, + "api_endpoint_search_index", + Entity.API_ENDPOINT, + "directory_search_index", + Entity.DIRECTORY, + "worksheet_search_index", + Entity.WORKSHEET, + "spreadsheet_search_index", + Entity.SPREADSHEET, + "file_search_index", + Entity.FILE, + "metric_search_index", + Entity.METRIC -> + true; default -> false; }; } @@ -452,13 +453,14 @@ public static boolean isDataAssetIndex(String indexName) { public static boolean isTimeSeriesIndex(String indexName) { return switch (indexName) { case "test_case_result_search_index", - "testCaseResult", - "test_case_resolution_status_search_index", - "testCaseResolutionStatus", - "raw_cost_analysis_report_data_index", - "rawCostAnalysisReportData", - "aggregated_cost_analysis_report_data_index", - "aggregatedCostAnalysisReportData" -> true; + "testCaseResult", + "test_case_resolution_status_search_index", + "testCaseResolutionStatus", + "raw_cost_analysis_report_data_index", + "rawCostAnalysisReportData", + "aggregated_cost_analysis_report_data_index", + "aggregatedCostAnalysisReportData" -> + true; default -> false; }; } @@ -480,27 +482,28 @@ public static boolean isColumnIndex(String indexName) { public static boolean isServiceIndex(String indexName) { return switch (indexName) { case "api_service_search_index", - "apiService", - "mlmodel_service_search_index", - "mlModelService", - "database_service_search_index", - "databaseService", - "messaging_service_index", - "messagingService", - "dashboard_service_index", - "dashboardService", - "pipeline_service_index", - "pipelineService", - "storage_service_index", - "storageService", - "search_service_index", - "searchService", - "security_service_index", - "securityService", - "metadata_service_index", - "metadataService", - "drive_service_index", - "driveService" -> true; + "apiService", + "mlmodel_service_search_index", + "mlModelService", + "database_service_search_index", + "databaseService", + "messaging_service_index", + "messagingService", + "dashboard_service_index", + "dashboardService", + "pipeline_service_index", + "pipelineService", + "storage_service_index", + "storageService", + "search_service_index", + "searchService", + "security_service_index", + "securityService", + "metadata_service_index", + "metadataService", + "drive_service_index", + "driveService" -> + true; default -> false; }; } @@ -517,8 +520,8 @@ public static String mapEntityTypesToIndexNames(String indexName) { case "container_search_index", Entity.CONTAINER -> Entity.CONTAINER; case "query_search_index", Entity.QUERY -> Entity.QUERY; case "stored_procedure_search_index", Entity.STORED_PROCEDURE -> Entity.STORED_PROCEDURE; - case "dashboard_data_model_search_index", Entity.DASHBOARD_DATA_MODEL -> Entity - .DASHBOARD_DATA_MODEL; + case "dashboard_data_model_search_index", Entity.DASHBOARD_DATA_MODEL -> + Entity.DASHBOARD_DATA_MODEL; case "api_endpoint_search_index", Entity.API_ENDPOINT -> Entity.API_ENDPOINT; case "api_collection_search_index", Entity.API_COLLECTION -> Entity.API_COLLECTION; case "metric_search_index", Entity.METRIC -> Entity.METRIC; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchColumnAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchColumnAggregator.java index 187235b11ea1..94f10d1528bb 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchColumnAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchColumnAggregator.java @@ -534,13 +534,14 @@ private Query buildMetadataStatusFilter(String status, String columnFieldPath) { return switch (status.toUpperCase()) { case "MISSING" -> Query.of(q -> q.bool(b -> b.must(noDesc).must(noTags))); - case "INCOMPLETE" -> Query.of( - q -> - q.bool( - b -> - b.should(Query.of(qs -> qs.bool(bs -> bs.must(hasDesc).must(noTags)))) - .should(Query.of(qs -> qs.bool(bs -> bs.must(noDesc).must(hasTags)))) - .minimumShouldMatch("1"))); + case "INCOMPLETE" -> + Query.of( + q -> + q.bool( + b -> + b.should(Query.of(qs -> qs.bool(bs -> bs.must(hasDesc).must(noTags)))) + .should(Query.of(qs -> qs.bool(bs -> bs.must(noDesc).must(hasTags)))) + .minimumShouldMatch("1"))); case "COMPLETE" -> Query.of(q -> q.bool(b -> b.must(hasDesc).must(hasTags))); default -> null; }; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchDataInsightAggregatorManager.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchDataInsightAggregatorManager.java index e00495f179d4..9e4f7744bfa6 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchDataInsightAggregatorManager.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchDataInsightAggregatorManager.java @@ -258,22 +258,22 @@ private DataInsightAggregatorInterface createDataAggregator( DataInsightChartResult.DataInsightChartType dataInsightChartType) throws IllegalArgumentException { return switch (dataInsightChartType) { - case DAILY_ACTIVE_USERS -> new ElasticSearchDailyActiveUsersAggregator( - response.aggregations()); - case PAGE_VIEWS_BY_ENTITIES -> new ElasticSearchPageViewsByEntitiesAggregator( - response.aggregations()); + case DAILY_ACTIVE_USERS -> + new ElasticSearchDailyActiveUsersAggregator(response.aggregations()); + case PAGE_VIEWS_BY_ENTITIES -> + new ElasticSearchPageViewsByEntitiesAggregator(response.aggregations()); case MOST_ACTIVE_USERS -> new ElasticSearchMostActiveUsersAggregator(response.aggregations()); - case MOST_VIEWED_ENTITIES -> new ElasticSearchMostViewedEntitiesAggregator( - response.aggregations()); + case MOST_VIEWED_ENTITIES -> + new ElasticSearchMostViewedEntitiesAggregator(response.aggregations()); case UNUSED_ASSETS -> new ElasticSearchUnusedAssetsAggregator(response.hits()); - case AGGREGATED_UNUSED_ASSETS_SIZE -> new ElasticSearchAggregatedUnusedAssetsSizeAggregator( - response.aggregations()); - case AGGREGATED_UNUSED_ASSETS_COUNT -> new ElasticSearchAggregatedUnusedAssetsCountAggregator( - response.aggregations()); - case AGGREGATED_USED_VS_UNUSED_ASSETS_COUNT -> new ElasticSearchAggregatedUsedvsUnusedAssetsCountAggregator( - response.aggregations()); - case AGGREGATED_USED_VS_UNUSED_ASSETS_SIZE -> new ElasticSearchAggregatedUsedvsUnusedAssetsSizeAggregator( - response.aggregations()); + case AGGREGATED_UNUSED_ASSETS_SIZE -> + new ElasticSearchAggregatedUnusedAssetsSizeAggregator(response.aggregations()); + case AGGREGATED_UNUSED_ASSETS_COUNT -> + new ElasticSearchAggregatedUnusedAssetsCountAggregator(response.aggregations()); + case AGGREGATED_USED_VS_UNUSED_ASSETS_COUNT -> + new ElasticSearchAggregatedUsedvsUnusedAssetsCountAggregator(response.aggregations()); + case AGGREGATED_USED_VS_UNUSED_ASSETS_SIZE -> + new ElasticSearchAggregatedUsedvsUnusedAssetsSizeAggregator(response.aggregations()); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchSourceBuilderFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchSourceBuilderFactory.java index ee62799dd9f2..45d0bc9a3004 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchSourceBuilderFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchSourceBuilderFactory.java @@ -347,10 +347,8 @@ public ElasticSearchRequestBuilder getSearchSourceBuilderV2( } return switch (indexName) { - case "user_search_index", - "user", - "team_search_index", - "team" -> buildUserOrTeamSearchBuilderV2(searchQuery, fromOffset, size); + case "user_search_index", "user", "team_search_index", "team" -> + buildUserOrTeamSearchBuilderV2(searchQuery, fromOffset, size); default -> buildAggregateSearchBuilderV2(searchQuery, fromOffset, size, includeAggregations); }; } @@ -359,11 +357,10 @@ public ElasticSearchRequestBuilder buildTimeSeriesSearchBuilderV2( String indexName, String query, int from, int size) { return switch (indexName) { case "test_case_result_search_index" -> buildTestCaseResultSearchV2(query, from, size); - case "test_case_resolution_status_search_index" -> buildTestCaseResolutionStatusSearchV2( - query, from, size); - case "raw_cost_analysis_report_data_index", - "aggregated_cost_analysis_report_data_index" -> buildCostAnalysisReportDataSearchV2( - query, from, size); + case "test_case_resolution_status_search_index" -> + buildTestCaseResolutionStatusSearchV2(query, from, size); + case "raw_cost_analysis_report_data_index", "aggregated_cost_analysis_report_data_index" -> + buildCostAnalysisReportDataSearchV2(query, from, size); default -> buildAggregateSearchBuilderV2(query, from, size); }; } @@ -462,10 +459,8 @@ public ElasticSearchRequestBuilder buildAggregateSearchBuilderV2( public ElasticSearchRequestBuilder buildDataQualitySearchBuilderV2( String indexName, String query, int from, int size) { return switch (indexName) { - case "test_case_search_index", - "testCase", - "test_suite_search_index", - "testSuite" -> buildTestCaseSearchV2(query, from, size); + case "test_case_search_index", "testCase", "test_suite_search_index", "testSuite" -> + buildTestCaseSearchV2(query, from, size); default -> buildAggregateSearchBuilderV2(query, from, size); }; } @@ -784,21 +779,21 @@ private es.co.elastic.clients.elasticsearch._types.query_dsl.Query buildConditio } return switch (modifier.value()) { - case "log" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier - .Log; - case "log1p" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier - .Log1p; - case "sqrt" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier - .Sqrt; - case "square" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier - .Square; + case "log" -> + es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier.Log; + case "log1p" -> + es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier.Log1p; + case "sqrt" -> + es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier.Sqrt; + case "square" -> + es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier.Square; case "ln" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier.Ln; - case "ln1p" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier - .Ln1p; - case "ln2p" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier - .Ln2p; - case "reciprocal" -> es.co.elastic.clients.elasticsearch._types.query_dsl - .FieldValueFactorModifier.Reciprocal; + case "ln1p" -> + es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier.Ln1p; + case "ln2p" -> + es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier.Ln2p; + case "reciprocal" -> + es.co.elastic.clients.elasticsearch._types.query_dsl.FieldValueFactorModifier.Reciprocal; default -> null; }; } @@ -809,8 +804,8 @@ private es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionScoreMode t case "avg" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionScoreMode.Avg; case "max" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionScoreMode.Max; case "min" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionScoreMode.Min; - case "multiply" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionScoreMode - .Multiply; + case "multiply" -> + es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionScoreMode.Multiply; case "first" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionScoreMode.First; default -> es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionScoreMode.Sum; }; @@ -823,8 +818,8 @@ private es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionBoostMode t case "avg" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionBoostMode.Avg; case "max" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionBoostMode.Max; case "min" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionBoostMode.Min; - case "replace" -> es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionBoostMode - .Replace; + case "replace" -> + es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionBoostMode.Replace; default -> es.co.elastic.clients.elasticsearch._types.query_dsl.FunctionBoostMode.Multiply; }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchColumnAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchColumnAggregator.java index 88a98a267f5b..3a9fa8cf1ba8 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchColumnAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchColumnAggregator.java @@ -474,13 +474,14 @@ private Query buildMetadataStatusFilter(String status) { return switch (status.toUpperCase()) { case "MISSING" -> Query.of(q -> q.bool(b -> b.must(noDesc).must(noTags))); - case "INCOMPLETE" -> Query.of( - q -> - q.bool( - b -> - b.should(Query.of(qs -> qs.bool(bs -> bs.must(hasDesc).must(noTags)))) - .should(Query.of(qs -> qs.bool(bs -> bs.must(noDesc).must(hasTags)))) - .minimumShouldMatch("1"))); + case "INCOMPLETE" -> + Query.of( + q -> + q.bool( + b -> + b.should(Query.of(qs -> qs.bool(bs -> bs.must(hasDesc).must(noTags)))) + .should(Query.of(qs -> qs.bool(bs -> bs.must(noDesc).must(hasTags)))) + .minimumShouldMatch("1"))); case "COMPLETE" -> Query.of(q -> q.bool(b -> b.must(hasDesc).must(hasTags))); default -> null; }; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchDataInsightAggregatorManager.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchDataInsightAggregatorManager.java index 94c35b75dd80..d93fc19e71a9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchDataInsightAggregatorManager.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchDataInsightAggregatorManager.java @@ -255,20 +255,20 @@ private DataInsightAggregatorInterface createDataAggregatorNew( throws IllegalArgumentException { return switch (dataInsightChartType) { case DAILY_ACTIVE_USERS -> new OpenSearchDailyActiveUsersAggregator(response.aggregations()); - case PAGE_VIEWS_BY_ENTITIES -> new OpenSearchPageViewsByEntitiesAggregator( - response.aggregations()); + case PAGE_VIEWS_BY_ENTITIES -> + new OpenSearchPageViewsByEntitiesAggregator(response.aggregations()); case MOST_ACTIVE_USERS -> new OpenSearchMostActiveUsersAggregator(response.aggregations()); - case MOST_VIEWED_ENTITIES -> new OpenSearchMostViewedEntitiesAggregator( - response.aggregations()); + case MOST_VIEWED_ENTITIES -> + new OpenSearchMostViewedEntitiesAggregator(response.aggregations()); case UNUSED_ASSETS -> new OpenSearchUnusedAssetsAggregator(response.hits()); - case AGGREGATED_UNUSED_ASSETS_SIZE -> new OpenSearchAggregatedUnusedAssetsSizeAggregator( - response.aggregations()); - case AGGREGATED_UNUSED_ASSETS_COUNT -> new OpenSearchAggregatedUnusedAssetsCountAggregator( - response.aggregations()); - case AGGREGATED_USED_VS_UNUSED_ASSETS_COUNT -> new OpenSearchAggregatedUsedvsUnusedAssetsCountAggregator( - response.aggregations()); - case AGGREGATED_USED_VS_UNUSED_ASSETS_SIZE -> new OpenSearchAggregatedUsedvsUnusedAssetsSizeAggregator( - response.aggregations()); + case AGGREGATED_UNUSED_ASSETS_SIZE -> + new OpenSearchAggregatedUnusedAssetsSizeAggregator(response.aggregations()); + case AGGREGATED_UNUSED_ASSETS_COUNT -> + new OpenSearchAggregatedUnusedAssetsCountAggregator(response.aggregations()); + case AGGREGATED_USED_VS_UNUSED_ASSETS_COUNT -> + new OpenSearchAggregatedUsedvsUnusedAssetsCountAggregator(response.aggregations()); + case AGGREGATED_USED_VS_UNUSED_ASSETS_SIZE -> + new OpenSearchAggregatedUsedvsUnusedAssetsSizeAggregator(response.aggregations()); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchSourceBuilderFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchSourceBuilderFactory.java index 7deb93c7d7da..8faa2ce948b8 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchSourceBuilderFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchSourceBuilderFactory.java @@ -328,10 +328,8 @@ public OpenSearchRequestBuilder getSearchSourceBuilderV2( } return switch (indexName) { - case "user_search_index", - "user", - "team_search_index", - "team" -> buildUserOrTeamSearchBuilderV2(searchQuery, fromOffset, size); + case "user_search_index", "user", "team_search_index", "team" -> + buildUserOrTeamSearchBuilderV2(searchQuery, fromOffset, size); default -> buildAggregateSearchBuilderV2(searchQuery, fromOffset, size, includeAggregations); }; } @@ -635,21 +633,21 @@ private os.org.opensearch.client.opensearch._types.query_dsl.Query buildConditio } return switch (modifier.value()) { - case "log" -> os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier - .Log; - case "log1p" -> os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier - .Log1p; - case "sqrt" -> os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier - .Sqrt; - case "square" -> os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier - .Square; + case "log" -> + os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier.Log; + case "log1p" -> + os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier.Log1p; + case "sqrt" -> + os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier.Sqrt; + case "square" -> + os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier.Square; case "ln" -> os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier.Ln; - case "ln1p" -> os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier - .Ln1p; - case "ln2p" -> os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier - .Ln2p; - case "reciprocal" -> os.org.opensearch.client.opensearch._types.query_dsl - .FieldValueFactorModifier.Reciprocal; + case "ln1p" -> + os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier.Ln1p; + case "ln2p" -> + os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier.Ln2p; + case "reciprocal" -> + os.org.opensearch.client.opensearch._types.query_dsl.FieldValueFactorModifier.Reciprocal; default -> null; }; } @@ -660,8 +658,8 @@ private os.org.opensearch.client.opensearch._types.query_dsl.FunctionScoreMode t case "avg" -> os.org.opensearch.client.opensearch._types.query_dsl.FunctionScoreMode.Avg; case "max" -> os.org.opensearch.client.opensearch._types.query_dsl.FunctionScoreMode.Max; case "min" -> os.org.opensearch.client.opensearch._types.query_dsl.FunctionScoreMode.Min; - case "multiply" -> os.org.opensearch.client.opensearch._types.query_dsl.FunctionScoreMode - .Multiply; + case "multiply" -> + os.org.opensearch.client.opensearch._types.query_dsl.FunctionScoreMode.Multiply; case "first" -> os.org.opensearch.client.opensearch._types.query_dsl.FunctionScoreMode.First; default -> os.org.opensearch.client.opensearch._types.query_dsl.FunctionScoreMode.Sum; }; @@ -674,8 +672,8 @@ private os.org.opensearch.client.opensearch._types.query_dsl.FunctionBoostMode t case "avg" -> os.org.opensearch.client.opensearch._types.query_dsl.FunctionBoostMode.Avg; case "max" -> os.org.opensearch.client.opensearch._types.query_dsl.FunctionBoostMode.Max; case "min" -> os.org.opensearch.client.opensearch._types.query_dsl.FunctionBoostMode.Min; - case "replace" -> os.org.opensearch.client.opensearch._types.query_dsl.FunctionBoostMode - .Replace; + case "replace" -> + os.org.opensearch.client.opensearch._types.query_dsl.FunctionBoostMode.Replace; default -> os.org.opensearch.client.opensearch._types.query_dsl.FunctionBoostMode.Multiply; }; } @@ -784,11 +782,10 @@ public OpenSearchRequestBuilder buildTimeSeriesSearchBuilderV2( String indexName, String query, int from, int size) { return switch (indexName) { case "test_case_result_search_index" -> buildTestCaseResultSearchV2(query, from, size); - case "test_case_resolution_status_search_index" -> buildTestCaseResolutionStatusSearchV2( - query, from, size); - case "raw_cost_analysis_report_data_index", - "aggregated_cost_analysis_report_data_index" -> buildCostAnalysisReportDataSearchV2( - query, from, size); + case "test_case_resolution_status_search_index" -> + buildTestCaseResolutionStatusSearchV2(query, from, size); + case "raw_cost_analysis_report_data_index", "aggregated_cost_analysis_report_data_index" -> + buildCostAnalysisReportDataSearchV2(query, from, size); default -> buildAggregateSearchBuilderV2(query, from, size); }; } @@ -796,10 +793,8 @@ public OpenSearchRequestBuilder buildTimeSeriesSearchBuilderV2( public OpenSearchRequestBuilder buildDataQualitySearchBuilderV2( String indexName, String query, int from, int size) { return switch (indexName) { - case "test_case_search_index", - "testCase", - "test_suite_search_index", - "testSuite" -> buildTestCaseSearchV2(query, from, size); + case "test_case_search_index", "testCase", "test_suite_search_index", "testSuite" -> + buildTestCaseSearchV2(query, from, size); default -> buildAggregateSearchBuilderV2(query, from, size); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/vector/VectorSearchQueryBuilder.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/vector/VectorSearchQueryBuilder.java index b731d7062eee..3680dc660131 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/vector/VectorSearchQueryBuilder.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/vector/VectorSearchQueryBuilder.java @@ -160,14 +160,16 @@ private static void appendFlat(StringBuilder sb, String field, List vals private static void appendOneFlat(StringBuilder sb, String field, String val) { switch (val) { case ANY -> sb.append("{\"exists\":{\"field\":\"").append(field).append("\"}}"); - case NONE -> sb.append("{\"bool\":{\"must_not\":{\"exists\":{\"field\":\"") - .append(field) - .append("\"}}}}"); - default -> sb.append("{\"term\":{\"") - .append(field) - .append("\":\"") - .append(escape(val)) - .append("\"}}"); + case NONE -> + sb.append("{\"bool\":{\"must_not\":{\"exists\":{\"field\":\"") + .append(field) + .append("\"}}}}"); + default -> + sb.append("{\"term\":{\"") + .append(field) + .append("\":\"") + .append(escape(val)) + .append("\"}}"); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManagerFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManagerFactory.java index 730df58d060f..f14a20fb6366 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManagerFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsManagerFactory.java @@ -37,18 +37,18 @@ public static SecretsManager createSecretsManager( switch (secretsManagerProvider) { case DB, AWS_SSM, AWS, AZURE_KV -> - /* - We handle AWS and AWS_SSM as a NoopSecretsManager since we don't - need to WRITE any secrets. We will be just reading them out of the - AWS instance on the INGESTION side, but the server does not need - to do anything here. + /* + We handle AWS and AWS_SSM as a NoopSecretsManager since we don't + need to WRITE any secrets. We will be just reading them out of the + AWS instance on the INGESTION side, but the server does not need + to do anything here. - If for example we want to set the AWS SSM (non-managed) we configure - the server as `secretsManager: aws-ssm` and set the Airflow env vars - to connect to AWS SSM as specified in the docs: - https://docs.open-metadata.org/deployment/secrets-manager/supported-implementations/aws-ssm-parameter-store - */ - secretsManager = DBSecretsManager.getInstance(secretsManagerProvider, secretsConfig); + If for example we want to set the AWS SSM (non-managed) we configure + the server as `secretsManager: aws-ssm` and set the Airflow env vars + to connect to AWS SSM as specified in the docs: + https://docs.open-metadata.org/deployment/secrets-manager/supported-implementations/aws-ssm-parameter-store + */ + secretsManager = DBSecretsManager.getInstance(secretsManagerProvider, secretsConfig); case MANAGED_AWS -> secretsManager = AWSSecretsManager.getInstance(secretsConfig); case MANAGED_AWS_SSM -> secretsManager = AWSSSMSecretsManager.getInstance(secretsConfig); case IN_MEMORY -> secretsManager = InMemorySecretsManager.getInstance(secretsConfig); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java index 2ddcda56c3d4..58aff4c7d826 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java @@ -354,8 +354,8 @@ public void sendInviteMailToUser( ex); } } - case USER_CREATE -> sendPasswordResetLink( - uriInfo, user, subject, INVITE_CREATE_PASSWORD_TEMPLATE); + case USER_CREATE -> + sendPasswordResetLink(uriInfo, user, subject, INVITE_CREATE_PASSWORD_TEMPLATE); default -> LOG.error("Invalid Password Create Type"); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/jwt/JWTTokenGenerator.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/jwt/JWTTokenGenerator.java index 10e622b8d6df..5b027be2a157 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/jwt/JWTTokenGenerator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/jwt/JWTTokenGenerator.java @@ -299,8 +299,9 @@ public static Algorithm getAlgorithm( case RS_256 -> Algorithm.RSA256(rsaPublicKey, rsaPrivateKey); case RS_384 -> Algorithm.RSA384(rsaPublicKey, rsaPrivateKey); case RS_512 -> Algorithm.RSA512(rsaPublicKey, rsaPrivateKey); - case ES_256, ES_384, ES_512 -> throw new IllegalArgumentException( - "EC algorithms require ECPublicKey/ECPrivateKey. Use getAlgorithm(algorithm, ecPublicKey, ecPrivateKey) instead."); + case ES_256, ES_384, ES_512 -> + throw new IllegalArgumentException( + "EC algorithms require ECPublicKey/ECPrivateKey. Use getAlgorithm(algorithm, ecPublicKey, ecPrivateKey) instead."); }; } @@ -312,8 +313,9 @@ public static Algorithm getAlgorithm( case ES_256 -> Algorithm.ECDSA256(ecPublicKey, ecPrivateKey); case ES_384 -> Algorithm.ECDSA384(ecPublicKey, ecPrivateKey); case ES_512 -> Algorithm.ECDSA512(ecPublicKey, ecPrivateKey); - case RS_256, RS_384, RS_512 -> throw new IllegalArgumentException( - "RSA algorithms require RSAPublicKey/RSAPrivateKey. Use getAlgorithm(algorithm, rsaPublicKey, rsaPrivateKey) instead."); + case RS_256, RS_384, RS_512 -> + throw new IllegalArgumentException( + "RSA algorithms require RSAPublicKey/RSAPrivateKey. Use getAlgorithm(algorithm, rsaPublicKey, rsaPrivateKey) instead."); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskFormExecutionResolver.java b/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskFormExecutionResolver.java index 04517c127c0f..a8c13625843d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskFormExecutionResolver.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskFormExecutionResolver.java @@ -183,40 +183,46 @@ private static TaskExecutionBinding defaultBinding(Task task) { } return switch (task.getType()) { - case DescriptionUpdate -> new TaskExecutionBinding( - HandlerType.DESCRIPTION_UPDATE, - MetadataOperation.EDIT_DESCRIPTION, - "fieldPath", - "newDescription", - null, - null, - null); - case TagUpdate -> new TaskExecutionBinding( - HandlerType.TAG_UPDATE, - MetadataOperation.EDIT_TAGS, - "fieldPath", - null, - "currentTags", - "tagsToAdd", - "tagsToRemove"); - case OwnershipUpdate -> new TaskExecutionBinding( - HandlerType.OWNERSHIP_UPDATE, - MetadataOperation.EDIT_OWNERS, - null, - null, - null, - null, - null); - case TierUpdate -> new TaskExecutionBinding( - HandlerType.TIER_UPDATE, MetadataOperation.EDIT_TIER, null, null, null, null, null); - case DomainUpdate -> new TaskExecutionBinding( - HandlerType.DOMAIN_UPDATE, MetadataOperation.EDIT_ALL, null, null, null, null, null); - case GlossaryApproval, RequestApproval -> new TaskExecutionBinding( - HandlerType.APPROVAL, MetadataOperation.EDIT_ALL, null, null, null, null, null); - case TestCaseResolution, IncidentResolution -> new TaskExecutionBinding( - HandlerType.INCIDENT, null, null, null, null, null, null); - case Suggestion -> new TaskExecutionBinding( - HandlerType.SUGGESTION, null, null, null, null, null, null); + case DescriptionUpdate -> + new TaskExecutionBinding( + HandlerType.DESCRIPTION_UPDATE, + MetadataOperation.EDIT_DESCRIPTION, + "fieldPath", + "newDescription", + null, + null, + null); + case TagUpdate -> + new TaskExecutionBinding( + HandlerType.TAG_UPDATE, + MetadataOperation.EDIT_TAGS, + "fieldPath", + null, + "currentTags", + "tagsToAdd", + "tagsToRemove"); + case OwnershipUpdate -> + new TaskExecutionBinding( + HandlerType.OWNERSHIP_UPDATE, + MetadataOperation.EDIT_OWNERS, + null, + null, + null, + null, + null); + case TierUpdate -> + new TaskExecutionBinding( + HandlerType.TIER_UPDATE, MetadataOperation.EDIT_TIER, null, null, null, null, null); + case DomainUpdate -> + new TaskExecutionBinding( + HandlerType.DOMAIN_UPDATE, MetadataOperation.EDIT_ALL, null, null, null, null, null); + case GlossaryApproval, RequestApproval -> + new TaskExecutionBinding( + HandlerType.APPROVAL, MetadataOperation.EDIT_ALL, null, null, null, null, null); + case TestCaseResolution, IncidentResolution -> + new TaskExecutionBinding(HandlerType.INCIDENT, null, null, null, null, null, null); + case Suggestion -> + new TaskExecutionBinding(HandlerType.SUGGESTION, null, null, null, null, null, null); default -> new TaskExecutionBinding(HandlerType.CUSTOM, null, null, null, null, null, null); }; } @@ -229,81 +235,88 @@ private static TaskExecutionPlan defaultExecutionPlan(Task task) { TaskExecutionBinding binding = defaultBinding(task); return switch (binding.handlerType()) { - case DESCRIPTION_UPDATE -> new TaskExecutionPlan( - List.of( - new TaskExecutionAction( - ActionType.SET_DESCRIPTION, - binding.fieldPathField(), - binding.valueField(), - null, - null, - null, - null, - null, - null)), - List.of()); - case TAG_UPDATE -> new TaskExecutionPlan( - List.of( - new TaskExecutionAction( - ActionType.MERGE_TAGS, - binding.fieldPathField(), - null, - binding.currentTagsField(), - binding.addTagsField(), - binding.removeTagsField(), - null, - null, - null)), - List.of()); - case OWNERSHIP_UPDATE -> new TaskExecutionPlan( - List.of( - new TaskExecutionAction( - ActionType.REPLACE_OWNERS, - null, - null, - null, - null, - null, - "newOwners", - null, - null)), - List.of()); - case TIER_UPDATE -> new TaskExecutionPlan( - List.of( - new TaskExecutionAction( - ActionType.APPLY_TIER, null, null, null, null, null, "newTier", null, null)), - List.of()); - case DOMAIN_UPDATE -> new TaskExecutionPlan( - List.of( - new TaskExecutionAction( - ActionType.REPLACE_DOMAINS, - null, - null, - null, - null, - null, - "newDomain", - null, - null)), - List.of()); - case APPROVAL -> new TaskExecutionPlan( - List.of( - new TaskExecutionAction( - ActionType.PATCH_ENTITY_FIELD, - null, - null, - null, - null, - null, - null, - "entityStatus", - "Approved")), - List.of()); - case SUGGESTION -> new TaskExecutionPlan( - List.of( - new TaskExecutionAction( - ActionType.APPLY_SUGGESTION, null, null, null, null, null, null, null, null)), - List.of()); + case DESCRIPTION_UPDATE -> + new TaskExecutionPlan( + List.of( + new TaskExecutionAction( + ActionType.SET_DESCRIPTION, + binding.fieldPathField(), + binding.valueField(), + null, + null, + null, + null, + null, + null)), + List.of()); + case TAG_UPDATE -> + new TaskExecutionPlan( + List.of( + new TaskExecutionAction( + ActionType.MERGE_TAGS, + binding.fieldPathField(), + null, + binding.currentTagsField(), + binding.addTagsField(), + binding.removeTagsField(), + null, + null, + null)), + List.of()); + case OWNERSHIP_UPDATE -> + new TaskExecutionPlan( + List.of( + new TaskExecutionAction( + ActionType.REPLACE_OWNERS, + null, + null, + null, + null, + null, + "newOwners", + null, + null)), + List.of()); + case TIER_UPDATE -> + new TaskExecutionPlan( + List.of( + new TaskExecutionAction( + ActionType.APPLY_TIER, null, null, null, null, null, "newTier", null, null)), + List.of()); + case DOMAIN_UPDATE -> + new TaskExecutionPlan( + List.of( + new TaskExecutionAction( + ActionType.REPLACE_DOMAINS, + null, + null, + null, + null, + null, + "newDomain", + null, + null)), + List.of()); + case APPROVAL -> + new TaskExecutionPlan( + List.of( + new TaskExecutionAction( + ActionType.PATCH_ENTITY_FIELD, + null, + null, + null, + null, + null, + null, + "entityStatus", + "Approved")), + List.of()); + case SUGGESTION -> + new TaskExecutionPlan( + List.of( + new TaskExecutionAction( + ActionType.APPLY_SUGGESTION, null, null, null, null, null, null, null, null)), + List.of()); default -> new TaskExecutionPlan(List.of(), List.of()); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowHandler.java b/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowHandler.java index d4bbca203aad..a87d12b4ee54 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowHandler.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowHandler.java @@ -514,15 +514,15 @@ private void executeConfiguredActions( String newValue) { for (TaskExecutionAction action : actions) { switch (action.actionType()) { - case SET_DESCRIPTION -> applyDescriptionAction( - task, entity, repository, user, newValue, payload, action); - case MERGE_TAGS -> applyMergeTagsAction( - task, entity, repository, user, newValue, payload, action); - case REPLACE_OWNERS -> applyReplaceOwnersAction( - task, entity, repository, user, payload, action); + case SET_DESCRIPTION -> + applyDescriptionAction(task, entity, repository, user, newValue, payload, action); + case MERGE_TAGS -> + applyMergeTagsAction(task, entity, repository, user, newValue, payload, action); + case REPLACE_OWNERS -> + applyReplaceOwnersAction(task, entity, repository, user, payload, action); case APPLY_TIER -> applyApplyTierAction(task, entity, repository, user, payload, action); - case REPLACE_DOMAINS -> applyReplaceDomainsAction( - task, entity, repository, user, payload, action); + case REPLACE_DOMAINS -> + applyReplaceDomainsAction(task, entity, repository, user, payload, action); case PATCH_ENTITY_FIELD -> applyPatchEntityFieldAction(task, entity, user, payload, action); case APPLY_SUGGESTION -> applySuggestion(task, payload, entity, repository, user); default -> LOG.debug("Unsupported task execution action '{}'", action.actionType()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowLifecycleResolver.java b/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowLifecycleResolver.java index e2dadadb1647..5c4aa5c8c64d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowLifecycleResolver.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowLifecycleResolver.java @@ -248,12 +248,8 @@ public static TaskCategory defaultTaskCategoryForWorkflowDefinitionRef( } return switch (defaultTaskTypeForWorkflowDefinitionRef(workflowDefinitionRef)) { - case DescriptionUpdate, - TagUpdate, - OwnershipUpdate, - TierUpdate, - DomainUpdate, - Suggestion -> TaskCategory.MetadataUpdate; + case DescriptionUpdate, TagUpdate, OwnershipUpdate, TierUpdate, DomainUpdate, Suggestion -> + TaskCategory.MetadataUpdate; case GlossaryApproval, RequestApproval -> TaskCategory.Approval; case DataAccessRequest -> TaskCategory.DataAccess; case IncidentResolution, TestCaseResolution -> TaskCategory.Incident; @@ -478,113 +474,124 @@ private static TaskFormSchema getDefaultSchema( } return switch (taskType) { - case DescriptionUpdate -> taskCategory == TaskCategory.MetadataUpdate - ? defaultSchema( - taskType, - taskCategory, - defaultWorkflowDefinitionRef(taskType), - namedObjectSchema( - "fieldPath", "currentDescription", "newDescription", "source", "confidence")) - : null; - case TagUpdate -> taskCategory == TaskCategory.MetadataUpdate - ? defaultSchema( - taskType, - taskCategory, - defaultWorkflowDefinitionRef(taskType), - namedObjectSchema( - "fieldPath", - "currentTags", - "tagsToAdd", - "tagsToRemove", - "operation", - "source", - "confidence")) - : null; - case OwnershipUpdate -> taskCategory == TaskCategory.MetadataUpdate - ? defaultSchema( - taskType, - taskCategory, - defaultWorkflowDefinitionRef(taskType), - schemaWithProperties( - Map.of( - "currentOwners", nullable(arrayOfObjectsProperty()), - "newOwners", arrayOfObjectsProperty(), - "reason", stringProperty()))) - : null; - case TierUpdate -> taskCategory == TaskCategory.MetadataUpdate - ? defaultSchema( - taskType, - taskCategory, - defaultWorkflowDefinitionRef(taskType), - schemaWithProperties( - Map.of( - "currentTier", nullable(objectProperty()), - "newTier", objectProperty(), - "reason", stringProperty()))) - : null; - case DomainUpdate -> taskCategory == TaskCategory.MetadataUpdate - ? defaultSchema( - taskType, - taskCategory, - defaultWorkflowDefinitionRef(taskType), - schemaWithProperties( - Map.of( - "currentDomain", nullable(objectProperty()), - "newDomain", objectProperty(), - "reason", stringProperty()))) - : null; - case GlossaryApproval, RequestApproval -> taskCategory == TaskCategory.Approval - ? defaultSchema( - taskType, - taskCategory, - defaultWorkflowDefinitionRef(taskType), - namedObjectSchema("comment")) - : null; - case DataAccessRequest -> taskCategory == TaskCategory.DataAccess - ? defaultSchema( - taskType, - taskCategory, - defaultWorkflowDefinitionRef(taskType), - schemaWithProperties( - Map.of( - "requestedAccess", stringProperty(), - "duration", stringProperty(), - "reason", stringProperty(), - "assets", Map.of("type", "array", "items", objectProperty()), - "ticketId", stringProperty(), - "expirationDate", stringProperty()))) - : null; - case TestCaseResolution, IncidentResolution -> taskCategory == TaskCategory.Incident - ? defaultSchema( - taskType, - taskCategory, - defaultWorkflowDefinitionRef(taskType), - namedObjectSchema("rootCause", "resolution")) - : null; - case PipelineReview -> taskCategory == TaskCategory.Review - ? defaultSchema( - taskType, - taskCategory, - defaultWorkflowDefinitionRef(taskType), - schemaWithProperties( - Map.of( - "reviewType", stringProperty(), - "reviewCriteria", Map.of("type", "array", "items", objectProperty()), - "findings", stringProperty(), - "recommendation", stringProperty(), - "attachments", Map.of("type", "array", "items", objectProperty())))) - : null; - case DataQualityReview -> taskCategory == TaskCategory.Review - ? defaultSchema( - taskType, - taskCategory, - defaultWorkflowDefinitionRef(taskType), - namedObjectSchema("comment")) - : null; - case CustomTask -> taskCategory == TaskCategory.Custom - ? defaultSchema( - taskType, taskCategory, defaultWorkflowDefinitionRef(taskType), objectSchema()) - : null; + case DescriptionUpdate -> + taskCategory == TaskCategory.MetadataUpdate + ? defaultSchema( + taskType, + taskCategory, + defaultWorkflowDefinitionRef(taskType), + namedObjectSchema( + "fieldPath", "currentDescription", "newDescription", "source", "confidence")) + : null; + case TagUpdate -> + taskCategory == TaskCategory.MetadataUpdate + ? defaultSchema( + taskType, + taskCategory, + defaultWorkflowDefinitionRef(taskType), + namedObjectSchema( + "fieldPath", + "currentTags", + "tagsToAdd", + "tagsToRemove", + "operation", + "source", + "confidence")) + : null; + case OwnershipUpdate -> + taskCategory == TaskCategory.MetadataUpdate + ? defaultSchema( + taskType, + taskCategory, + defaultWorkflowDefinitionRef(taskType), + schemaWithProperties( + Map.of( + "currentOwners", nullable(arrayOfObjectsProperty()), + "newOwners", arrayOfObjectsProperty(), + "reason", stringProperty()))) + : null; + case TierUpdate -> + taskCategory == TaskCategory.MetadataUpdate + ? defaultSchema( + taskType, + taskCategory, + defaultWorkflowDefinitionRef(taskType), + schemaWithProperties( + Map.of( + "currentTier", nullable(objectProperty()), + "newTier", objectProperty(), + "reason", stringProperty()))) + : null; + case DomainUpdate -> + taskCategory == TaskCategory.MetadataUpdate + ? defaultSchema( + taskType, + taskCategory, + defaultWorkflowDefinitionRef(taskType), + schemaWithProperties( + Map.of( + "currentDomain", nullable(objectProperty()), + "newDomain", objectProperty(), + "reason", stringProperty()))) + : null; + case GlossaryApproval, RequestApproval -> + taskCategory == TaskCategory.Approval + ? defaultSchema( + taskType, + taskCategory, + defaultWorkflowDefinitionRef(taskType), + namedObjectSchema("comment")) + : null; + case DataAccessRequest -> + taskCategory == TaskCategory.DataAccess + ? defaultSchema( + taskType, + taskCategory, + defaultWorkflowDefinitionRef(taskType), + schemaWithProperties( + Map.of( + "requestedAccess", stringProperty(), + "duration", stringProperty(), + "reason", stringProperty(), + "assets", Map.of("type", "array", "items", objectProperty()), + "ticketId", stringProperty(), + "expirationDate", stringProperty()))) + : null; + case TestCaseResolution, IncidentResolution -> + taskCategory == TaskCategory.Incident + ? defaultSchema( + taskType, + taskCategory, + defaultWorkflowDefinitionRef(taskType), + namedObjectSchema("rootCause", "resolution")) + : null; + case PipelineReview -> + taskCategory == TaskCategory.Review + ? defaultSchema( + taskType, + taskCategory, + defaultWorkflowDefinitionRef(taskType), + schemaWithProperties( + Map.of( + "reviewType", stringProperty(), + "reviewCriteria", Map.of("type", "array", "items", objectProperty()), + "findings", stringProperty(), + "recommendation", stringProperty(), + "attachments", Map.of("type", "array", "items", objectProperty())))) + : null; + case DataQualityReview -> + taskCategory == TaskCategory.Review + ? defaultSchema( + taskType, + taskCategory, + defaultWorkflowDefinitionRef(taskType), + namedObjectSchema("comment")) + : null; + case CustomTask -> + taskCategory == TaskCategory.Custom + ? defaultSchema( + taskType, taskCategory, defaultWorkflowDefinitionRef(taskType), objectSchema()) + : null; default -> null; }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/FeedUtils.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/FeedUtils.java index 3cc0ed3bbce8..7e81fe71180b 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/FeedUtils.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/FeedUtils.java @@ -80,8 +80,8 @@ private static List populateMessageForDataAssets( addEntityInfoToThread(thread, Thread.CardStyle.ENTITY_CREATED, message, entityInterface); yield List.of(thread.withMessage(message)); } - case ENTITY_UPDATED -> getFormattedMessages( - messageDecorator, thread, changeEvent.getChangeDescription()); + case ENTITY_UPDATED -> + getFormattedMessages(messageDecorator, thread, changeEvent.getChangeDescription()); case ENTITY_SOFT_DELETED -> { message = String.format( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/ODCSConverter.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/ODCSConverter.java index a8439f264e7f..9314caf7776f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/ODCSConverter.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/ODCSConverter.java @@ -426,8 +426,8 @@ private static ODCSSchemaElement.LogicalType mapDataTypeToLogicalType(ColumnData case TIME -> ODCSSchemaElement.LogicalType.TIME; case ARRAY -> ODCSSchemaElement.LogicalType.ARRAY; case MAP, STRUCT, JSON -> ODCSSchemaElement.LogicalType.OBJECT; - case BLOB, BYTEA, BINARY, VARBINARY, LONGBLOB, MEDIUMBLOB -> ODCSSchemaElement.LogicalType - .BYTES; + case BLOB, BYTEA, BINARY, VARBINARY, LONGBLOB, MEDIUMBLOB -> + ODCSSchemaElement.LogicalType.BYTES; case TEXT, MEDIUMTEXT, CLOB, NTEXT -> ODCSSchemaElement.LogicalType.TEXT; default -> ODCSSchemaElement.LogicalType.STRING; }; @@ -1069,8 +1069,8 @@ public static ODCSQualityRule.OdcsQualityMetric mapTestDefinitionToODCSMetric( if (testDefinitionName == null) return null; return switch (testDefinitionName.toLowerCase()) { case "columnvaluestobenotnull" -> ODCSQualityRule.OdcsQualityMetric.NULL_VALUES; - case "tablerowcounttoequal", "tablerowcounttobebetween" -> ODCSQualityRule.OdcsQualityMetric - .ROW_COUNT; + case "tablerowcounttoequal", "tablerowcounttobebetween" -> + ODCSQualityRule.OdcsQualityMetric.ROW_COUNT; case "columnvaluestobeunique" -> ODCSQualityRule.OdcsQualityMetric.UNIQUE_VALUES; case "columnvaluesmissingcounttobeequal" -> ODCSQualityRule.OdcsQualityMetric.MISSING_VALUES; default -> null; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/OpenMetadataConnectionBuilder.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/OpenMetadataConnectionBuilder.java index aeabfe7a1d0e..3e2daf1ade83 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/OpenMetadataConnectionBuilder.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/OpenMetadataConnectionBuilder.java @@ -93,8 +93,9 @@ private String getBotFromPipeline(IngestionPipeline ingestionPipeline) { String type = IngestionPipelineRepository.getPipelineWorkflowType(ingestionPipeline); botName = String.format("%sApplicationBot", type); } - default -> botName = - String.format("%s-bot", ingestionPipeline.getPipelineType().toString().toLowerCase()); + default -> + botName = + String.format("%s-bot", ingestionPipeline.getPipelineType().toString().toLowerCase()); } return botName; } @@ -144,14 +145,16 @@ private void initializeBotUser(String botName) { private AuthProvider extractAuthProvider(User botUser) { AuthenticationMechanism.AuthType authType = botUser.getAuthenticationMechanism().getAuthType(); return switch (authType) { - case SSO -> AuthProvider.fromValue( - JsonUtils.convertValue( - botUser.getAuthenticationMechanism().getConfig(), SSOAuthMechanism.class) - .getSsoServiceType() - .value()); + case SSO -> + AuthProvider.fromValue( + JsonUtils.convertValue( + botUser.getAuthenticationMechanism().getConfig(), SSOAuthMechanism.class) + .getSsoServiceType() + .value()); case JWT -> AuthProvider.OPENMETADATA; - default -> throw new IllegalArgumentException( - String.format("Not supported authentication mechanism type: [%s]", authType.value())); + default -> + throw new IllegalArgumentException( + String.format("Not supported authentication mechanism type: [%s]", authType.value())); }; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java index 66d0e8a28014..e2475f37c4d8 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/SubscriptionUtil.java @@ -409,17 +409,18 @@ public static Set getTargetsForAlert( Thread thread = AlertsRuleEvaluator.getThread(event); switch (thread.getType()) { case Task -> receiverUrls.addAll(getTaskAssignees(action, category, type, event)); - case Conversation -> receiverUrls.addAll( - handleConversationNotification(action, category, type, event)); - // TODO: For Announcement, Immediate Consumer needs to be Notified (find information from - // Lineage) - case Announcement -> receiverUrls.addAll( - buildReceivers( - action, - category, - type, - thread.getEntityRef().getType(), - thread.getEntityRef().getId())); + case Conversation -> + receiverUrls.addAll(handleConversationNotification(action, category, type, event)); + // TODO: For Announcement, Immediate Consumer needs to be Notified (find information from + // Lineage) + case Announcement -> + receiverUrls.addAll( + buildReceivers( + action, + category, + type, + thread.getEntityRef().getType(), + thread.getEntityRef().getId())); } } else { EntityInterface entityInterface = getEntity(event); diff --git a/openmetadata-service/src/test/java/org/openmetadata/csv/EntityCsvTest.java b/openmetadata-service/src/test/java/org/openmetadata/csv/EntityCsvTest.java index 4a06a031a623..9f004be39d4d 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/csv/EntityCsvTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/csv/EntityCsvTest.java @@ -2889,24 +2889,38 @@ private static T invokePrivate( throws Exception { Class[] parameterTypes = switch (methodName) { - case "parseLongField" -> new Class[] { - CSVPrinter.class, CSVRecord.class, int.class, String.class, String.class, Object.class - }; - case "parseTimeInterval" -> new Class[] { - CSVPrinter.class, CSVRecord.class, int.class, String.class, Object.class - }; - case "parseEnumType" -> new Class[] { - CSVPrinter.class, - CSVRecord.class, - int.class, - String.class, - String.class, - Object.class, - String.class - }; - case "parseTableType" -> new Class[] { - CSVPrinter.class, CSVRecord.class, int.class, String.class, Object.class, String.class - }; + case "parseLongField" -> + new Class[] { + CSVPrinter.class, + CSVRecord.class, + int.class, + String.class, + String.class, + Object.class + }; + case "parseTimeInterval" -> + new Class[] { + CSVPrinter.class, CSVRecord.class, int.class, String.class, Object.class + }; + case "parseEnumType" -> + new Class[] { + CSVPrinter.class, + CSVRecord.class, + int.class, + String.class, + String.class, + Object.class, + String.class + }; + case "parseTableType" -> + new Class[] { + CSVPrinter.class, + CSVRecord.class, + int.class, + String.class, + Object.class, + String.class + }; default -> throw new IllegalArgumentException("Unsupported method " + methodName); }; diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepositoryTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepositoryTest.java index bed26db6b0f2..3111c9e6c71d 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepositoryTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepositoryTest.java @@ -237,13 +237,16 @@ private boolean isValidTransition( return false; } return switch (from) { - case New -> to == TestCaseResolutionStatusTypes.Ack - || to == TestCaseResolutionStatusTypes.Assigned - || to == TestCaseResolutionStatusTypes.Resolved; - case Ack -> to == TestCaseResolutionStatusTypes.Assigned - || to == TestCaseResolutionStatusTypes.Resolved; - case Assigned -> to == TestCaseResolutionStatusTypes.Assigned - || to == TestCaseResolutionStatusTypes.Resolved; + case New -> + to == TestCaseResolutionStatusTypes.Ack + || to == TestCaseResolutionStatusTypes.Assigned + || to == TestCaseResolutionStatusTypes.Resolved; + case Ack -> + to == TestCaseResolutionStatusTypes.Assigned + || to == TestCaseResolutionStatusTypes.Resolved; + case Assigned -> + to == TestCaseResolutionStatusTypes.Assigned + || to == TestCaseResolutionStatusTypes.Resolved; default -> false; }; } diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/search/ColumnFilterMatcherTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/search/ColumnFilterMatcherTest.java index ddf8a6d4cae4..320ad21b7343 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/search/ColumnFilterMatcherTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/search/ColumnFilterMatcherTest.java @@ -56,10 +56,10 @@ void matchesColumnFilterUsesMetadataCacheForTagAndGlossaryFilters() { Set.of("service.db.schema.customers.customer_id", "service.db.schema.orders.customer_id"), parentFqn -> switch (parentFqn) { - case "service.db.schema.customers" -> doc( - "service.db.schema.customers", column("customer_id", "PII.Sensitive")); - case "service.db.schema.orders" -> doc( - "service.db.schema.orders", column("customer_id", "Glossary.Location")); + case "service.db.schema.customers" -> + doc("service.db.schema.customers", column("customer_id", "PII.Sensitive")); + case "service.db.schema.orders" -> + doc("service.db.schema.orders", column("customer_id", "Glossary.Location")); default -> throw new IllegalArgumentException(parentFqn); }); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/search/QueryFilterParserTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/search/QueryFilterParserTest.java index 27ebb39da446..05b87e583774 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/search/QueryFilterParserTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/search/QueryFilterParserTest.java @@ -170,7 +170,8 @@ void parseFilterClausesHandlesMixedTermAndWildcard() { @Test void parseFilterClausesFallsBackToWholeNodeIfNoBoolMust() { - String jsonFilter = """ + String jsonFilter = + """ {"term": {"tags.tagFQN.keyword": "Tier.Gold"}} """; @@ -258,7 +259,8 @@ void matchesFilterClausesSingleClauseBehavesLikeMatchesFilter() { @Test void parseFilterHandlesWildcardQuerySimpleFormat() { - String jsonFilter = """ + String jsonFilter = + """ {"wildcard": {"name": "*data*"}} """; @@ -269,7 +271,8 @@ void parseFilterHandlesWildcardQuerySimpleFormat() { @Test void parseFilterHandlesWildcardQueryObjectFormat() { - String jsonFilter = """ + String jsonFilter = + """ {"wildcard": {"name": {"value": "*data*"}}} """; @@ -280,7 +283,8 @@ void parseFilterHandlesWildcardQueryObjectFormat() { @Test void parseFilterSkipsWildcardWithOnlyStars() { - String jsonFilter = """ + String jsonFilter = + """ {"wildcard": {"name": "**"}} """; diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/search/elasticsearch/EsUtilsTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/search/elasticsearch/EsUtilsTest.java index 0f9714a8e49d..1e6389bf6e7e 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/search/elasticsearch/EsUtilsTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/search/elasticsearch/EsUtilsTest.java @@ -158,7 +158,8 @@ void testParseJsonQuery_withNestedQuery() throws JsonProcessingException { @Test void testParseJsonQuery_simpleTermQuery() throws JsonProcessingException { - String simpleQuery = """ + String simpleQuery = + """ { "term": {"owner": "admin"} } @@ -191,7 +192,8 @@ void testParseJsonQuery_emptyObject() throws JsonProcessingException { @Test void testParseJsonQuery_queryWrapperOnly() throws JsonProcessingException { - String queryWrapperOnly = """ + String queryWrapperOnly = + """ { "query": {} } diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/search/opensearch/OsUtilsTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/search/opensearch/OsUtilsTest.java index e0a25d633171..e665f8dce7f6 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/search/opensearch/OsUtilsTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/search/opensearch/OsUtilsTest.java @@ -96,7 +96,8 @@ void testParseJsonQuery_withoutOuterQueryWrapper() throws JsonProcessingExceptio @Test void testParseJsonQuery_resultIsBase64Encoded() throws JsonProcessingException { - String query = """ + String query = + """ { "term": {"status": "active"} } @@ -187,7 +188,8 @@ void testParseJsonQuery_withNestedQuery() throws JsonProcessingException { @Test void testParseJsonQuery_simpleTermQuery() throws JsonProcessingException { - String simpleQuery = """ + String simpleQuery = + """ { "term": {"owner": "admin"} } @@ -222,7 +224,8 @@ void testParseJsonQuery_emptyObject() throws JsonProcessingException { @Test void testParseJsonQuery_queryWrapperOnly() throws JsonProcessingException { - String queryWrapperOnly = """ + String queryWrapperOnly = + """ { "query": {} } diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/security/auth/UserActivityTrackerTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/security/auth/UserActivityTrackerTest.java index 724febbde286..552ce0ed7c70 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/security/auth/UserActivityTrackerTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/security/auth/UserActivityTrackerTest.java @@ -249,14 +249,18 @@ void testVerifyCorrectTimestampsAreTracked() throws Exception { long activityTime = (long) lastActivityTimeField.get(activity); switch (entry.getKey()) { - case "alice" -> assertTrue( - Math.abs(activityTime - time1) < 500, - "Alice's activity time should be close to time1"); - case "bob" -> assertTrue( - Math.abs(activityTime - time2) < 500, "Bob's activity time should be close to time2"); - case "charlie" -> assertTrue( - Math.abs(activityTime - time3) < 500, - "Charlie's activity time should be close to time3"); + case "alice" -> + assertTrue( + Math.abs(activityTime - time1) < 500, + "Alice's activity time should be close to time1"); + case "bob" -> + assertTrue( + Math.abs(activityTime - time2) < 500, + "Bob's activity time should be close to time2"); + case "charlie" -> + assertTrue( + Math.abs(activityTime - time3) < 500, + "Charlie's activity time should be close to time3"); } } diff --git a/openmetadata-spec/pom.xml b/openmetadata-spec/pom.xml index 9d68616afda4..b51b0810d737 100644 --- a/openmetadata-spec/pom.xml +++ b/openmetadata-spec/pom.xml @@ -186,6 +186,13 @@ common ${project.version} + + + org.codehaus.plexus + plexus-utils + 3.6.0 + diff --git a/pom.xml b/pom.xml index 41489ca1d506..89896796a92b 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,7 @@ 5.14.2 2.0.4 - 2.18.6 + 2.21.2 5.0.0 5.0.0 1.0 @@ -98,16 +98,16 @@ 2.11.0 9.3.0 42.7.7 - 1.2.2 + 1.3.0 1.18.36 - 11.0.5 + 11.0.11 7.0.2 7.17.25 2.6.0 4.1.5 2.2.25 4.5.14 - 6.2.11 + 6.2.17 2.25.3 5.11.4 1.11.4 @@ -143,14 +143,14 @@ 2.3 5.4.0 1.29.2 - 2.41.1 + 2.46.0 4.7.6 1.5.25 1.5.25 2.9.0 1.14.4 1.13 - 12.1.6 + 12.1.7 5.0.0-M1 1.1.1 6.7.1.RELEASE @@ -208,25 +208,14 @@ fernet-java8 ${fernet.version} + - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - com.fasterxml.jackson.module - jackson-module-blackbird + com.fasterxml.jackson + jackson-bom ${jackson.version} + pom + import io.dropwizard @@ -721,6 +710,58 @@ flyway-mysql ${flyway.version} + + + org.apache.httpcomponents.core5 + httpcore5 + 5.3.5 + + + org.apache.httpcomponents.core5 + httpcore5-h2 + 5.3.5 + + + org.apache.httpcomponents.client5 + httpclient5 + 5.5 + + + org.bouncycastle + bcpkix-jdk18on + 1.84 + + + org.bouncycastle + bcprov-jdk18on + 1.84 + + + org.bouncycastle + bcutil-jdk18on + 1.84 + + + org.jetbrains.kotlin + kotlin-stdlib + 2.1.0 + + + org.jetbrains.kotlin + kotlin-stdlib-jdk7 + 2.1.0 + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + 2.1.0 + + + org.apache.tomcat + tomcat-juli + ${tomcat-jdbc.version} +