From a98e8c6afb510d4f6ba9d93ba5911f2342cece66 Mon Sep 17 00:00:00 2001 From: sureshms Date: Thu, 21 Oct 2021 19:24:28 -0700 Subject: [PATCH] Usage resource migrated to jdbi3 --- .../catalog/jdbi3/MetricsDAO3.java | 5 +- .../catalog/jdbi3/TableRepositoryHelper.java | 91 ++++++++++--------- .../openmetadata/catalog/jdbi3/UsageDAO.java | 2 +- .../catalog/jdbi3/UsageRepository3.java | 57 ++++++++++++ ...sitory.java => UsageRepositoryHelper.java} | 78 +++++----------- .../resources/usage/UsageResource.java | 10 +- .../openmetadata/catalog/util/EntityUtil.java | 64 ------------- 7 files changed, 134 insertions(+), 173 deletions(-) create mode 100644 catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageRepository3.java rename catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/{UsageRepository.java => UsageRepositoryHelper.java} (65%) diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/MetricsDAO3.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/MetricsDAO3.java index 75e4bc44aee..05b2098ec02 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/MetricsDAO3.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/MetricsDAO3.java @@ -1,10 +1,7 @@ package org.openmetadata.catalog.jdbi3; +import org.jdbi.v3.sqlobject.statement.SqlQuery; import org.openmetadata.catalog.entity.data.Metrics; -import org.openmetadata.catalog.entity.data.Table; -import org.skife.jdbi.v2.sqlobject.Bind; -import org.skife.jdbi.v2.sqlobject.SqlQuery; -import org.skife.jdbi.v2.sqlobject.SqlUpdate; import java.util.List; diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepositoryHelper.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepositoryHelper.java index 847c0d187a2..3cb1c158a99 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepositoryHelper.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepositoryHelper.java @@ -84,49 +84,49 @@ public class TableRepositoryHelper implements EntityRepository { private final TableRepository3 repo3; - @Override - public List listAfter(String fqnPrefix, int limitParam, String after) { - return repo3.tableDAO().listAfter(fqnPrefix, limitParam, after); - } + @Override + public List listAfter(String fqnPrefix, int limitParam, String after) { + return repo3.tableDAO().listAfter(fqnPrefix, limitParam, after); + } - @Override - public List listBefore(String fqnPrefix, int limitParam, String after) { - return repo3.tableDAO().listBefore(fqnPrefix, limitParam, after); - } + @Override + public List listBefore(String fqnPrefix, int limitParam, String after) { + return repo3.tableDAO().listBefore(fqnPrefix, limitParam, after); + } - @Override - public int listCount(String fqnPrefix) { - return repo3.tableDAO().listCount(fqnPrefix); - } + @Override + public int listCount(String fqnPrefix) { + return repo3.tableDAO().listCount(fqnPrefix); + } - @Override - public String getFullyQualifiedName(Table entity) { - return entity.getFullyQualifiedName(); - } + @Override + public String getFullyQualifiedName(Table entity) { + return entity.getFullyQualifiedName(); + } - @Override - public Table setFields(Table table, Fields fields) throws IOException, ParseException { - table.setColumns(fields.contains("columns") ? table.getColumns() : null); - table.setTableConstraints(fields.contains("tableConstraints") ? table.getTableConstraints() : null); - table.setOwner(fields.contains("owner") ? getOwner(table) : null); - table.setFollowers(fields.contains("followers") ? getFollowers(table) : null); - table.setUsageSummary(fields.contains("usageSummary") ? EntityUtil.getLatestUsage(repo3.usageDAO(), table.getId()) : - null); - table.setDatabase(fields.contains("database") ? EntityUtil.getEntityReference(getDatabase(table)) : null); - table.setTags(fields.contains("tags") ? getTags(table.getFullyQualifiedName()) : null); - getColumnTags(fields.contains("tags"), table.getColumns()); - table.setJoins(fields.contains("joins") ? getJoins(table) : null); - table.setSampleData(fields.contains("sampleData") ? getSampleData(table) : null); - table.setViewDefinition(fields.contains("viewDefinition") ? table.getViewDefinition() : null); - table.setTableProfile(fields.contains("tableProfile") ? getTableProfile(table): null); - return table; - } + @Override + public Table setFields(Table table, Fields fields) throws IOException, ParseException { + table.setColumns(fields.contains("columns") ? table.getColumns() : null); + table.setTableConstraints(fields.contains("tableConstraints") ? table.getTableConstraints() : null); + table.setOwner(fields.contains("owner") ? getOwner(table) : null); + table.setFollowers(fields.contains("followers") ? getFollowers(table) : null); + table.setUsageSummary(fields.contains("usageSummary") ? EntityUtil.getLatestUsage(repo3.usageDAO(), table.getId()) : + null); + table.setDatabase(fields.contains("database") ? EntityUtil.getEntityReference(getDatabase(table)) : null); + table.setTags(fields.contains("tags") ? getTags(table.getFullyQualifiedName()) : null); + getColumnTags(fields.contains("tags"), table.getColumns()); + table.setJoins(fields.contains("joins") ? getJoins(table) : null); + table.setSampleData(fields.contains("sampleData") ? getSampleData(table) : null); + table.setViewDefinition(fields.contains("viewDefinition") ? table.getViewDefinition() : null); + table.setTableProfile(fields.contains("tableProfile") ? getTableProfile(table) : null); + return table; + } - @Override - public ResultList
getResultList(List
entities, String beforeCursor, String afterCursor, int total) - throws GeneralSecurityException, UnsupportedEncodingException { - return new TableList(entities, beforeCursor, afterCursor, total); - } + @Override + public ResultList
getResultList(List
entities, String beforeCursor, String afterCursor, int total) + throws GeneralSecurityException, UnsupportedEncodingException { + return new TableList(entities, beforeCursor, afterCursor, total); + } public static String getFQN(Table table) { return (table.getDatabase().getName() + "." + table.getName()); @@ -135,7 +135,7 @@ public class TableRepositoryHelper implements EntityRepository
{ @Transaction public ResultList
listAfter(Fields fields, String databaseFQN, int limitParam, String after) throws IOException, ParseException, GeneralSecurityException { - return EntityUtil.listAfter(this, Table.class, fields, databaseFQN, limitParam, after); + return EntityUtil.listAfter(this, Table.class, fields, databaseFQN, limitParam, after); } @Transaction @@ -204,7 +204,8 @@ public class TableRepositoryHelper implements EntityRepository
{ @Transaction public Status addFollower(String tableId, String userId) throws IOException { repo3.tableDAO().findEntityById(tableId); - return EntityUtil.addFollower(repo3.relationshipDAO(), repo3.userDAO(), tableId, Entity.TABLE, userId, Entity.USER) ? + return EntityUtil.addFollower(repo3.relationshipDAO(), repo3.userDAO(), tableId, Entity.TABLE, userId, + Entity.USER) ? Status.CREATED : Status.OK; } @@ -263,7 +264,7 @@ public class TableRepositoryHelper implements EntityRepository
{ } } //validate all the columns - for (ColumnProfile columnProfile: tableProfile.getColumnProfile()) { + for (ColumnProfile columnProfile : tableProfile.getColumnProfile()) { validateColumn(table, columnProfile.getName()); } storedMapTableProfiles.put(tableProfile.getProfileDate(), tableProfile); @@ -448,7 +449,8 @@ public class TableRepositoryHelper implements EntityRepository
{ } private EntityReference getOwner(Table table) throws IOException { - return table == null ? null : EntityUtil.populateOwner(table.getId(), repo3.relationshipDAO(), repo3.userDAO(), repo3.teamDAO()); + return table == null ? null : EntityUtil.populateOwner(table.getId(), repo3.relationshipDAO(), repo3.userDAO(), + repo3.teamDAO()); } private List getFollowers(Table table) throws IOException { @@ -628,8 +630,9 @@ public class TableRepositoryHelper implements EntityRepository
{ TableData.class); } - private List getTableProfile(Table table) throws IOException { - List tableProfiles = JsonUtils.readObjects(repo3.entityExtensionDAO().getExtension(table.getId().toString(), + private List getTableProfile(Table table) throws IOException { + List tableProfiles = + JsonUtils.readObjects(repo3.entityExtensionDAO().getExtension(table.getId().toString(), "table.tableProfile"), TableProfile.class); if (tableProfiles != null) { diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageDAO.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageDAO.java index 35ba047b1dc..b2cc79475a7 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageDAO.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageDAO.java @@ -1,6 +1,6 @@ package org.openmetadata.catalog.jdbi3; -import org.openmetadata.catalog.jdbi3.UsageRepository.UsageDetailsMapper; +import org.openmetadata.catalog.jdbi3.UsageRepositoryHelper.UsageDetailsMapper; import org.openmetadata.catalog.type.UsageDetails; import org.skife.jdbi.v2.sqlobject.Bind; import org.skife.jdbi.v2.sqlobject.SqlQuery; diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageRepository3.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageRepository3.java new file mode 100644 index 00000000000..462c708016f --- /dev/null +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageRepository3.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openmetadata.catalog.jdbi3; + +import org.jdbi.v3.sqlobject.CreateSqlObject; + +public interface UsageRepository3 { + @CreateSqlObject + UsageDAO3 usageDAO(); + + @CreateSqlObject + TableDAO3 tableDAO(); + + @CreateSqlObject + DatabaseDAO3 databaseDAO(); + + @CreateSqlObject + MetricsDAO3 metricsDAO(); + + @CreateSqlObject + DashboardDAO3 dashboardDAO(); + + @CreateSqlObject + ReportDAO3 reportDAO(); + + @CreateSqlObject + TopicDAO3 topicDAO(); + + @CreateSqlObject + ChartDAO3 chartDAO(); + + @CreateSqlObject + TaskDAO3 taskDAO(); + + @CreateSqlObject + PipelineDAO3 pipelineDAO(); + + @CreateSqlObject + ModelDAO3 modelDAO(); + + @CreateSqlObject + EntityRelationshipDAO3 relationshipDAO(); +} diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageRepository.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageRepositoryHelper.java similarity index 65% rename from catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageRepository.java rename to catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageRepositoryHelper.java index 48d2a9de7a2..9eac6e6db1b 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageRepository.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/UsageRepositoryHelper.java @@ -17,14 +17,13 @@ package org.openmetadata.catalog.jdbi3; import org.openmetadata.catalog.Entity; +import org.openmetadata.catalog.type.DailyCount; import org.openmetadata.catalog.type.EntityReference; import org.openmetadata.catalog.type.EntityUsage; import org.openmetadata.catalog.type.UsageDetails; -import org.openmetadata.catalog.type.DailyCount; import org.openmetadata.catalog.type.UsageStats; import org.openmetadata.catalog.util.EntityUtil; import org.skife.jdbi.v2.StatementContext; -import org.skife.jdbi.v2.sqlobject.CreateSqlObject; import org.skife.jdbi.v2.sqlobject.Transaction; import org.skife.jdbi.v2.tweak.ResultSetMapper; import org.slf4j.Logger; @@ -38,93 +37,62 @@ import java.util.UUID; import static org.openmetadata.catalog.util.EntityUtil.getEntityReference; -public abstract class UsageRepository { - private static final Logger LOG = LoggerFactory.getLogger(UsageRepository.class); - - @CreateSqlObject - abstract UsageDAO usageDAO(); - - @CreateSqlObject - abstract TableDAO tableDAO(); - - @CreateSqlObject - abstract DatabaseDAO databaseDAO(); - - @CreateSqlObject - abstract MetricsDAO metricsDAO(); - - @CreateSqlObject - abstract DashboardDAO dashboardDAO(); - - @CreateSqlObject - abstract ReportDAO reportDAO(); - - @CreateSqlObject - abstract TopicDAO topicDAO(); - - @CreateSqlObject - abstract ChartDAO chartDAO(); - - @CreateSqlObject - abstract TaskDAO taskDAO(); - - @CreateSqlObject - abstract PipelineDAO pipelineDAO(); - - @CreateSqlObject - abstract ModelDAO modelDAO(); - - @CreateSqlObject - abstract EntityRelationshipDAO relationshipDAO(); +public class UsageRepositoryHelper { + private static final Logger LOG = LoggerFactory.getLogger(UsageRepositoryHelper.class); + public UsageRepositoryHelper(UsageRepository3 repo3) { this.repo3 = repo3; } + private final UsageRepository3 repo3; @Transaction public EntityUsage get(String entityType, String id, String date, int days) throws IOException { - EntityReference ref = getEntityReference(entityType, UUID.fromString(id), tableDAO(), databaseDAO(), - metricsDAO(), dashboardDAO(), reportDAO(), topicDAO(), chartDAO(), taskDAO(), modelDAO(), pipelineDAO()); - List usageDetails = usageDAO().getUsageById(id, date, days - 1); + EntityReference ref = getEntityReference(entityType, UUID.fromString(id), repo3.tableDAO(), repo3.databaseDAO(), + repo3.metricsDAO(), repo3.dashboardDAO(), repo3.reportDAO(), repo3.topicDAO(), repo3.chartDAO(), + repo3.taskDAO(), repo3.modelDAO(), repo3.pipelineDAO()); + List usageDetails = repo3.usageDAO().getUsageById(id, date, days - 1); return new EntityUsage().withUsage(usageDetails).withEntity(ref); } @Transaction public EntityUsage getByName(String entityType, String fqn, String date, int days) throws IOException { - EntityReference ref = EntityUtil.getEntityReferenceByName(entityType, fqn, tableDAO(), databaseDAO(), - metricsDAO(), reportDAO(), topicDAO(), chartDAO(), dashboardDAO(), taskDAO(), modelDAO(), pipelineDAO()); - List usageDetails = usageDAO().getUsageById(ref.getId().toString(), date, days - 1); + EntityReference ref = EntityUtil.getEntityReferenceByName(entityType, fqn, repo3.tableDAO(), repo3.databaseDAO(), + repo3.metricsDAO(), repo3.reportDAO(), repo3.topicDAO(), repo3.chartDAO(), repo3.dashboardDAO(), + repo3.taskDAO(), repo3.modelDAO(), repo3.pipelineDAO()); + List usageDetails = repo3.usageDAO().getUsageById(ref.getId().toString(), date, days - 1); return new EntityUsage().withUsage(usageDetails).withEntity(ref); } @Transaction public void create(String entityType, String id, DailyCount usage) throws IOException { // Validate data entity for which usage is being collected - getEntityReference(entityType, UUID.fromString(id), tableDAO(), databaseDAO(), metricsDAO(), - dashboardDAO(), reportDAO(), topicDAO(), chartDAO(), taskDAO(), modelDAO(), pipelineDAO()); + getEntityReference(entityType, UUID.fromString(id), repo3.tableDAO(), repo3.databaseDAO(), repo3.metricsDAO(), + repo3.dashboardDAO(), repo3.reportDAO(), repo3.topicDAO(), repo3.chartDAO(), repo3.taskDAO(), + repo3.modelDAO(), repo3.pipelineDAO()); addUsage(entityType, id, usage); } @Transaction public void createByName(String entityType, String fullyQualifiedName, DailyCount usage) throws IOException { - EntityReference ref = EntityUtil.getEntityReferenceByName(entityType, fullyQualifiedName, tableDAO(), - databaseDAO(), metricsDAO(), reportDAO(), topicDAO(), chartDAO(), dashboardDAO(), - taskDAO(), modelDAO(), pipelineDAO()); + EntityReference ref = EntityUtil.getEntityReferenceByName(entityType, fullyQualifiedName, repo3.tableDAO(), + repo3.databaseDAO(), repo3.metricsDAO(), repo3.reportDAO(), repo3.topicDAO(), repo3.chartDAO(), + repo3.dashboardDAO(), repo3.taskDAO(), repo3.modelDAO(), repo3.pipelineDAO()); addUsage(entityType, ref.getId().toString(), usage); LOG.info("Usage successfully posted by name"); } @Transaction public void computePercentile(String entityType, String date) { - usageDAO().computePercentile(entityType, date); + repo3.usageDAO().computePercentile(entityType, date); } private void addUsage(String entityType, String entityId, DailyCount usage) { // Insert usage record - usageDAO().insert(usage.getDate(), entityId, entityType, usage.getCount()); + repo3.usageDAO().insert(usage.getDate(), entityId, entityType, usage.getCount()); // If table usage was reported, add the usage count to database if (entityType.equalsIgnoreCase(Entity.TABLE)) { - List databaseIds = relationshipDAO().findFrom(entityId, Relationship.CONTAINS.ordinal(), Entity.DATABASE); - usageDAO().insertOrUpdateCount(usage.getDate(), databaseIds.get(0), Entity.DATABASE, usage.getCount()); + List databaseIds = repo3.relationshipDAO().findFrom(entityId, Relationship.CONTAINS.ordinal(), Entity.DATABASE); + repo3.usageDAO().insertOrUpdateCount(usage.getDate(), databaseIds.get(0), Entity.DATABASE, usage.getCount()); } } diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/usage/UsageResource.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/usage/UsageResource.java index 8b616daedd6..c05d650c73c 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/usage/UsageResource.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/usage/UsageResource.java @@ -17,8 +17,8 @@ package org.openmetadata.catalog.resources.usage; import com.google.inject.Inject; +import org.openmetadata.catalog.jdbi3.UsageRepositoryHelper; import org.openmetadata.catalog.resources.teams.UserResource; -import org.openmetadata.catalog.jdbi3.UsageRepository; import org.openmetadata.catalog.resources.Collection; import org.openmetadata.catalog.type.EntityUsage; import org.openmetadata.catalog.type.DailyCount; @@ -54,14 +54,14 @@ import java.util.Objects; @Api(value = "Usage resource", tags = "Usage resource") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -@Collection(name = "usage", repositoryClass = "org.openmetadata.catalog.jdbi3.UsageRepository") +//@Collection(name = "usage", repositoryClass = "org.openmetadata.catalog.jdbi3.UsageRepositoryHelper") public class UsageResource { private static final Logger LOG = LoggerFactory.getLogger(UserResource.class); - private final UsageRepository dao; + private final UsageRepositoryHelper dao; @Inject - public UsageResource(UsageRepository dao, CatalogAuthorizer authorizer) { - Objects.requireNonNull(dao, "UsageRepository must not be null"); + public UsageResource(UsageRepositoryHelper dao, CatalogAuthorizer authorizer) { + Objects.requireNonNull(dao, "UsageRepositoryHelper must not be null"); this.dao = dao; } diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/util/EntityUtil.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/util/EntityUtil.java index 45fe96de8fb..1323fa7fe39 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/util/EntityUtil.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/util/EntityUtil.java @@ -348,19 +348,6 @@ public final class EntityUtil { setOwner(dao, ownedEntityId, ownedEntityType, newOwner); } - public static List getEntityReference(List list, TableDAO tableDAO, - DatabaseDAO databaseDAO, MetricsDAO metricsDAO, - DashboardDAO dashboardDAO, ReportDAO reportDAO, - TopicDAO topicDAO, ChartDAO chartDAO, - TaskDAO taskDAO, ModelDAO modelDAO, - PipelineDAO pipelineDAO) throws IOException { - for (EntityReference ref : list) { - getEntityReference(ref, tableDAO, databaseDAO, metricsDAO, dashboardDAO, reportDAO, topicDAO, chartDAO, - taskDAO, modelDAO, pipelineDAO); - } - return list; - } - public static List getEntityReference(List list, TableDAO3 tableDAO, DatabaseDAO3 databaseDAO, MetricsDAO3 metricsDAO, DashboardDAO3 dashboardDAO, ReportDAO3 reportDAO, @@ -375,47 +362,6 @@ public final class EntityUtil { } - public static EntityReference getEntityReference(EntityReference ref, TableDAO tableDAO, DatabaseDAO databaseDAO, - MetricsDAO metricsDAO, DashboardDAO dashboardDAO, - ReportDAO reportDAO, TopicDAO topicDAO, ChartDAO chartDAO, - TaskDAO taskDAO, ModelDAO modelDAO, PipelineDAO pipelineDAO) - throws IOException { - // Note href to entity reference is not added here - String entity = ref.getType(); - String id = ref.getId().toString(); - if (entity.equalsIgnoreCase(Entity.TABLE)) { - Table instance = EntityUtil.validate(id, tableDAO.findById(id), Table.class); - return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName()); - } else if (entity.equalsIgnoreCase(Entity.DATABASE)) { - Database instance = EntityUtil.validate(id, databaseDAO.findById(id), Database.class); - return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName()); - } else if (entity.equalsIgnoreCase(Entity.METRICS)) { - Metrics instance = EntityUtil.validate(id, metricsDAO.findById(id), Metrics.class); - return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName()); - } else if (entity.equalsIgnoreCase(Entity.DASHBOARD)) { - Dashboard instance = EntityUtil.validate(id, dashboardDAO.findById(id), Dashboard.class); - return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName()); - } else if (entity.equalsIgnoreCase(Entity.REPORT)) { - Report instance = EntityUtil.validate(id, reportDAO.findById(id), Report.class); - return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName()); - } else if (entity.equalsIgnoreCase(Entity.TOPIC)) { - Topic instance = EntityUtil.validate(id, topicDAO.findById(id), Topic.class); - return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName()); - } else if (entity.equalsIgnoreCase(Entity.CHART)) { - Chart instance = EntityUtil.validate(id, chartDAO.findById(id), Chart.class); - return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName()); - } else if (entity.equalsIgnoreCase(Entity.TASK)) { - Task instance = EntityUtil.validate(id, taskDAO.findById(id), Task.class); - return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName()); - } else if (entity.equalsIgnoreCase(Entity.PIPELINE)) { - Pipeline instance = EntityUtil.validate(id, pipelineDAO.findById(id), Pipeline.class); - return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName()); - } else if (entity.equalsIgnoreCase(Entity.MODEL)) { - Model instance = EntityUtil.validate(id, modelDAO.findById(id), Model.class); - return ref.withDescription(instance.getDescription()).withName(instance.getFullyQualifiedName()); - } - throw EntityNotFoundException.byMessage(CatalogExceptionMessage.entityTypeNotFound(entity)); - } public static EntityReference getEntityReference3(EntityReference ref, TableDAO3 tableDAO, DatabaseDAO3 databaseDAO, MetricsDAO3 metricsDAO, DashboardDAO3 dashboardDAO, @@ -459,16 +405,6 @@ public final class EntityUtil { throw EntityNotFoundException.byMessage(CatalogExceptionMessage.entityTypeNotFound(entity)); } - public static EntityReference getEntityReference(String entity, UUID id, TableDAO tableDAO, DatabaseDAO databaseDAO, - MetricsDAO metricsDAO, DashboardDAO dashboardDAO, - ReportDAO reportDAO, TopicDAO topicDAO, ChartDAO chartDAO, - TaskDAO taskDAO, ModelDAO modelDAO, PipelineDAO pipelineDAO) - throws IOException { - EntityReference ref = new EntityReference().withId(id).withType(entity); - return getEntityReference(ref, tableDAO, databaseDAO, metricsDAO, dashboardDAO, - reportDAO, topicDAO, chartDAO, taskDAO, modelDAO, pipelineDAO); - } - public static EntityReference getEntityReference(String entity, UUID id, TableDAO3 tableDAO, DatabaseDAO3 databaseDAO, MetricsDAO3 metricsDAO, DashboardDAO3 dashboardDAO,