Usage resource migrated to jdbi3

This commit is contained in:
sureshms 2021-10-21 19:24:28 -07:00
parent b84220a6a8
commit a98e8c6afb
7 changed files with 134 additions and 173 deletions

View File

@ -1,10 +1,7 @@
package org.openmetadata.catalog.jdbi3; 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.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; import java.util.List;

View File

@ -84,49 +84,49 @@ public class TableRepositoryHelper implements EntityRepository<Table> {
private final TableRepository3 repo3; private final TableRepository3 repo3;
@Override @Override
public List<String> listAfter(String fqnPrefix, int limitParam, String after) { public List<String> listAfter(String fqnPrefix, int limitParam, String after) {
return repo3.tableDAO().listAfter(fqnPrefix, limitParam, after); return repo3.tableDAO().listAfter(fqnPrefix, limitParam, after);
} }
@Override @Override
public List<String> listBefore(String fqnPrefix, int limitParam, String after) { public List<String> listBefore(String fqnPrefix, int limitParam, String after) {
return repo3.tableDAO().listBefore(fqnPrefix, limitParam, after); return repo3.tableDAO().listBefore(fqnPrefix, limitParam, after);
} }
@Override @Override
public int listCount(String fqnPrefix) { public int listCount(String fqnPrefix) {
return repo3.tableDAO().listCount(fqnPrefix); return repo3.tableDAO().listCount(fqnPrefix);
} }
@Override @Override
public String getFullyQualifiedName(Table entity) { public String getFullyQualifiedName(Table entity) {
return entity.getFullyQualifiedName(); return entity.getFullyQualifiedName();
} }
@Override @Override
public Table setFields(Table table, Fields fields) throws IOException, ParseException { public Table setFields(Table table, Fields fields) throws IOException, ParseException {
table.setColumns(fields.contains("columns") ? table.getColumns() : null); table.setColumns(fields.contains("columns") ? table.getColumns() : null);
table.setTableConstraints(fields.contains("tableConstraints") ? table.getTableConstraints() : null); table.setTableConstraints(fields.contains("tableConstraints") ? table.getTableConstraints() : null);
table.setOwner(fields.contains("owner") ? getOwner(table) : null); table.setOwner(fields.contains("owner") ? getOwner(table) : null);
table.setFollowers(fields.contains("followers") ? getFollowers(table) : null); table.setFollowers(fields.contains("followers") ? getFollowers(table) : null);
table.setUsageSummary(fields.contains("usageSummary") ? EntityUtil.getLatestUsage(repo3.usageDAO(), table.getId()) : table.setUsageSummary(fields.contains("usageSummary") ? EntityUtil.getLatestUsage(repo3.usageDAO(), table.getId()) :
null); null);
table.setDatabase(fields.contains("database") ? EntityUtil.getEntityReference(getDatabase(table)) : null); table.setDatabase(fields.contains("database") ? EntityUtil.getEntityReference(getDatabase(table)) : null);
table.setTags(fields.contains("tags") ? getTags(table.getFullyQualifiedName()) : null); table.setTags(fields.contains("tags") ? getTags(table.getFullyQualifiedName()) : null);
getColumnTags(fields.contains("tags"), table.getColumns()); getColumnTags(fields.contains("tags"), table.getColumns());
table.setJoins(fields.contains("joins") ? getJoins(table) : null); table.setJoins(fields.contains("joins") ? getJoins(table) : null);
table.setSampleData(fields.contains("sampleData") ? getSampleData(table) : null); table.setSampleData(fields.contains("sampleData") ? getSampleData(table) : null);
table.setViewDefinition(fields.contains("viewDefinition") ? table.getViewDefinition() : null); table.setViewDefinition(fields.contains("viewDefinition") ? table.getViewDefinition() : null);
table.setTableProfile(fields.contains("tableProfile") ? getTableProfile(table): null); table.setTableProfile(fields.contains("tableProfile") ? getTableProfile(table) : null);
return table; return table;
} }
@Override @Override
public ResultList<Table> getResultList(List<Table> entities, String beforeCursor, String afterCursor, int total) public ResultList<Table> getResultList(List<Table> entities, String beforeCursor, String afterCursor, int total)
throws GeneralSecurityException, UnsupportedEncodingException { throws GeneralSecurityException, UnsupportedEncodingException {
return new TableList(entities, beforeCursor, afterCursor, total); return new TableList(entities, beforeCursor, afterCursor, total);
} }
public static String getFQN(Table table) { public static String getFQN(Table table) {
return (table.getDatabase().getName() + "." + table.getName()); return (table.getDatabase().getName() + "." + table.getName());
@ -135,7 +135,7 @@ public class TableRepositoryHelper implements EntityRepository<Table> {
@Transaction @Transaction
public ResultList<Table> listAfter(Fields fields, String databaseFQN, int limitParam, String after) public ResultList<Table> listAfter(Fields fields, String databaseFQN, int limitParam, String after)
throws IOException, ParseException, GeneralSecurityException { 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 @Transaction
@ -204,7 +204,8 @@ public class TableRepositoryHelper implements EntityRepository<Table> {
@Transaction @Transaction
public Status addFollower(String tableId, String userId) throws IOException { public Status addFollower(String tableId, String userId) throws IOException {
repo3.tableDAO().findEntityById(tableId); 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; Status.CREATED : Status.OK;
} }
@ -263,7 +264,7 @@ public class TableRepositoryHelper implements EntityRepository<Table> {
} }
} }
//validate all the columns //validate all the columns
for (ColumnProfile columnProfile: tableProfile.getColumnProfile()) { for (ColumnProfile columnProfile : tableProfile.getColumnProfile()) {
validateColumn(table, columnProfile.getName()); validateColumn(table, columnProfile.getName());
} }
storedMapTableProfiles.put(tableProfile.getProfileDate(), tableProfile); storedMapTableProfiles.put(tableProfile.getProfileDate(), tableProfile);
@ -448,7 +449,8 @@ public class TableRepositoryHelper implements EntityRepository<Table> {
} }
private EntityReference getOwner(Table table) throws IOException { 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<EntityReference> getFollowers(Table table) throws IOException { private List<EntityReference> getFollowers(Table table) throws IOException {
@ -628,8 +630,9 @@ public class TableRepositoryHelper implements EntityRepository<Table> {
TableData.class); TableData.class);
} }
private List<TableProfile> getTableProfile(Table table) throws IOException { private List<TableProfile> getTableProfile(Table table) throws IOException {
List<TableProfile> tableProfiles = JsonUtils.readObjects(repo3.entityExtensionDAO().getExtension(table.getId().toString(), List<TableProfile> tableProfiles =
JsonUtils.readObjects(repo3.entityExtensionDAO().getExtension(table.getId().toString(),
"table.tableProfile"), "table.tableProfile"),
TableProfile.class); TableProfile.class);
if (tableProfiles != null) { if (tableProfiles != null) {

View File

@ -1,6 +1,6 @@
package org.openmetadata.catalog.jdbi3; 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.openmetadata.catalog.type.UsageDetails;
import org.skife.jdbi.v2.sqlobject.Bind; import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.SqlQuery; import org.skife.jdbi.v2.sqlobject.SqlQuery;

View File

@ -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();
}

View File

@ -17,14 +17,13 @@
package org.openmetadata.catalog.jdbi3; package org.openmetadata.catalog.jdbi3;
import org.openmetadata.catalog.Entity; import org.openmetadata.catalog.Entity;
import org.openmetadata.catalog.type.DailyCount;
import org.openmetadata.catalog.type.EntityReference; import org.openmetadata.catalog.type.EntityReference;
import org.openmetadata.catalog.type.EntityUsage; import org.openmetadata.catalog.type.EntityUsage;
import org.openmetadata.catalog.type.UsageDetails; import org.openmetadata.catalog.type.UsageDetails;
import org.openmetadata.catalog.type.DailyCount;
import org.openmetadata.catalog.type.UsageStats; import org.openmetadata.catalog.type.UsageStats;
import org.openmetadata.catalog.util.EntityUtil; import org.openmetadata.catalog.util.EntityUtil;
import org.skife.jdbi.v2.StatementContext; 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.sqlobject.Transaction;
import org.skife.jdbi.v2.tweak.ResultSetMapper; import org.skife.jdbi.v2.tweak.ResultSetMapper;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -38,93 +37,62 @@ import java.util.UUID;
import static org.openmetadata.catalog.util.EntityUtil.getEntityReference; import static org.openmetadata.catalog.util.EntityUtil.getEntityReference;
public abstract class UsageRepository { public class UsageRepositoryHelper {
private static final Logger LOG = LoggerFactory.getLogger(UsageRepository.class); private static final Logger LOG = LoggerFactory.getLogger(UsageRepositoryHelper.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 UsageRepositoryHelper(UsageRepository3 repo3) { this.repo3 = repo3; }
private final UsageRepository3 repo3;
@Transaction @Transaction
public EntityUsage get(String entityType, String id, String date, int days) throws IOException { public EntityUsage get(String entityType, String id, String date, int days) throws IOException {
EntityReference ref = getEntityReference(entityType, UUID.fromString(id), tableDAO(), databaseDAO(), EntityReference ref = getEntityReference(entityType, UUID.fromString(id), repo3.tableDAO(), repo3.databaseDAO(),
metricsDAO(), dashboardDAO(), reportDAO(), topicDAO(), chartDAO(), taskDAO(), modelDAO(), pipelineDAO()); repo3.metricsDAO(), repo3.dashboardDAO(), repo3.reportDAO(), repo3.topicDAO(), repo3.chartDAO(),
List<UsageDetails> usageDetails = usageDAO().getUsageById(id, date, days - 1); repo3.taskDAO(), repo3.modelDAO(), repo3.pipelineDAO());
List<UsageDetails> usageDetails = repo3.usageDAO().getUsageById(id, date, days - 1);
return new EntityUsage().withUsage(usageDetails).withEntity(ref); return new EntityUsage().withUsage(usageDetails).withEntity(ref);
} }
@Transaction @Transaction
public EntityUsage getByName(String entityType, String fqn, String date, int days) throws IOException { public EntityUsage getByName(String entityType, String fqn, String date, int days) throws IOException {
EntityReference ref = EntityUtil.getEntityReferenceByName(entityType, fqn, tableDAO(), databaseDAO(), EntityReference ref = EntityUtil.getEntityReferenceByName(entityType, fqn, repo3.tableDAO(), repo3.databaseDAO(),
metricsDAO(), reportDAO(), topicDAO(), chartDAO(), dashboardDAO(), taskDAO(), modelDAO(), pipelineDAO()); repo3.metricsDAO(), repo3.reportDAO(), repo3.topicDAO(), repo3.chartDAO(), repo3.dashboardDAO(),
List<UsageDetails> usageDetails = usageDAO().getUsageById(ref.getId().toString(), date, days - 1); repo3.taskDAO(), repo3.modelDAO(), repo3.pipelineDAO());
List<UsageDetails> usageDetails = repo3.usageDAO().getUsageById(ref.getId().toString(), date, days - 1);
return new EntityUsage().withUsage(usageDetails).withEntity(ref); return new EntityUsage().withUsage(usageDetails).withEntity(ref);
} }
@Transaction @Transaction
public void create(String entityType, String id, DailyCount usage) throws IOException { public void create(String entityType, String id, DailyCount usage) throws IOException {
// Validate data entity for which usage is being collected // Validate data entity for which usage is being collected
getEntityReference(entityType, UUID.fromString(id), tableDAO(), databaseDAO(), metricsDAO(), getEntityReference(entityType, UUID.fromString(id), repo3.tableDAO(), repo3.databaseDAO(), repo3.metricsDAO(),
dashboardDAO(), reportDAO(), topicDAO(), chartDAO(), taskDAO(), modelDAO(), pipelineDAO()); repo3.dashboardDAO(), repo3.reportDAO(), repo3.topicDAO(), repo3.chartDAO(), repo3.taskDAO(),
repo3.modelDAO(), repo3.pipelineDAO());
addUsage(entityType, id, usage); addUsage(entityType, id, usage);
} }
@Transaction @Transaction
public void createByName(String entityType, String fullyQualifiedName, DailyCount usage) throws IOException { public void createByName(String entityType, String fullyQualifiedName, DailyCount usage) throws IOException {
EntityReference ref = EntityUtil.getEntityReferenceByName(entityType, fullyQualifiedName, tableDAO(), EntityReference ref = EntityUtil.getEntityReferenceByName(entityType, fullyQualifiedName, repo3.tableDAO(),
databaseDAO(), metricsDAO(), reportDAO(), topicDAO(), chartDAO(), dashboardDAO(), repo3.databaseDAO(), repo3.metricsDAO(), repo3.reportDAO(), repo3.topicDAO(), repo3.chartDAO(),
taskDAO(), modelDAO(), pipelineDAO()); repo3.dashboardDAO(), repo3.taskDAO(), repo3.modelDAO(), repo3.pipelineDAO());
addUsage(entityType, ref.getId().toString(), usage); addUsage(entityType, ref.getId().toString(), usage);
LOG.info("Usage successfully posted by name"); LOG.info("Usage successfully posted by name");
} }
@Transaction @Transaction
public void computePercentile(String entityType, String date) { 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) { private void addUsage(String entityType, String entityId, DailyCount usage) {
// Insert usage record // 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 table usage was reported, add the usage count to database
if (entityType.equalsIgnoreCase(Entity.TABLE)) { if (entityType.equalsIgnoreCase(Entity.TABLE)) {
List<String> databaseIds = relationshipDAO().findFrom(entityId, Relationship.CONTAINS.ordinal(), Entity.DATABASE); List<String> databaseIds = repo3.relationshipDAO().findFrom(entityId, Relationship.CONTAINS.ordinal(), Entity.DATABASE);
usageDAO().insertOrUpdateCount(usage.getDate(), databaseIds.get(0), Entity.DATABASE, usage.getCount()); repo3.usageDAO().insertOrUpdateCount(usage.getDate(), databaseIds.get(0), Entity.DATABASE, usage.getCount());
} }
} }

View File

@ -17,8 +17,8 @@
package org.openmetadata.catalog.resources.usage; package org.openmetadata.catalog.resources.usage;
import com.google.inject.Inject; import com.google.inject.Inject;
import org.openmetadata.catalog.jdbi3.UsageRepositoryHelper;
import org.openmetadata.catalog.resources.teams.UserResource; import org.openmetadata.catalog.resources.teams.UserResource;
import org.openmetadata.catalog.jdbi3.UsageRepository;
import org.openmetadata.catalog.resources.Collection; import org.openmetadata.catalog.resources.Collection;
import org.openmetadata.catalog.type.EntityUsage; import org.openmetadata.catalog.type.EntityUsage;
import org.openmetadata.catalog.type.DailyCount; import org.openmetadata.catalog.type.DailyCount;
@ -54,14 +54,14 @@ import java.util.Objects;
@Api(value = "Usage resource", tags = "Usage resource") @Api(value = "Usage resource", tags = "Usage resource")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(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 { public class UsageResource {
private static final Logger LOG = LoggerFactory.getLogger(UserResource.class); private static final Logger LOG = LoggerFactory.getLogger(UserResource.class);
private final UsageRepository dao; private final UsageRepositoryHelper dao;
@Inject @Inject
public UsageResource(UsageRepository dao, CatalogAuthorizer authorizer) { public UsageResource(UsageRepositoryHelper dao, CatalogAuthorizer authorizer) {
Objects.requireNonNull(dao, "UsageRepository must not be null"); Objects.requireNonNull(dao, "UsageRepositoryHelper must not be null");
this.dao = dao; this.dao = dao;
} }

View File

@ -348,19 +348,6 @@ public final class EntityUtil {
setOwner(dao, ownedEntityId, ownedEntityType, newOwner); setOwner(dao, ownedEntityId, ownedEntityType, newOwner);
} }
public static List<EntityReference> getEntityReference(List<EntityReference> 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<EntityReference> getEntityReference(List<EntityReference> list, TableDAO3 tableDAO, public static List<EntityReference> getEntityReference(List<EntityReference> list, TableDAO3 tableDAO,
DatabaseDAO3 databaseDAO, MetricsDAO3 metricsDAO, DatabaseDAO3 databaseDAO, MetricsDAO3 metricsDAO,
DashboardDAO3 dashboardDAO, ReportDAO3 reportDAO, 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, public static EntityReference getEntityReference3(EntityReference ref, TableDAO3 tableDAO, DatabaseDAO3 databaseDAO,
MetricsDAO3 metricsDAO, DashboardDAO3 dashboardDAO, MetricsDAO3 metricsDAO, DashboardDAO3 dashboardDAO,
@ -459,16 +405,6 @@ public final class EntityUtil {
throw EntityNotFoundException.byMessage(CatalogExceptionMessage.entityTypeNotFound(entity)); 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, public static EntityReference getEntityReference(String entity, UUID id, TableDAO3 tableDAO,
DatabaseDAO3 databaseDAO, DatabaseDAO3 databaseDAO,
MetricsDAO3 metricsDAO, DashboardDAO3 dashboardDAO, MetricsDAO3 metricsDAO, DashboardDAO3 dashboardDAO,