mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-21 14:59:57 +00:00
This commit is contained in:
parent
a649e723cd
commit
40b7389741
@ -63,8 +63,6 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
|
||||
private Injector injector;
|
||||
private Authorizer authorizer;
|
||||
|
||||
public CatalogApplication() {}
|
||||
|
||||
@Override
|
||||
public void run(CatalogApplicationConfig catalogConfig, Environment environment)
|
||||
throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException,
|
||||
@ -176,7 +174,9 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
|
||||
.manage(
|
||||
new Managed() {
|
||||
@Override
|
||||
public void start() {}
|
||||
public void start() {
|
||||
LOG.info("Application starting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
|
@ -38,8 +38,6 @@ import org.slf4j.LoggerFactory;
|
||||
public class CatalogGenericExceptionMapper implements ExceptionMapper<Throwable> {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CatalogGenericExceptionMapper.class);
|
||||
|
||||
public CatalogGenericExceptionMapper() {}
|
||||
|
||||
@Override
|
||||
public Response toResponse(Throwable ex) {
|
||||
if (ex instanceof ProcessingException || ex instanceof IllegalArgumentException) {
|
||||
|
@ -16,14 +16,12 @@ package org.openmetadata.catalog.jdbi3;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.openmetadata.catalog.Entity;
|
||||
import org.openmetadata.catalog.entity.Bots;
|
||||
import org.openmetadata.catalog.resources.bots.BotsResource;
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
|
||||
@ -36,7 +34,10 @@ public class BotsRepository extends EntityRepository<Bots> {
|
||||
dao.botsDAO(),
|
||||
dao,
|
||||
Fields.EMPTY_FIELDS,
|
||||
Fields.EMPTY_FIELDS);
|
||||
Fields.EMPTY_FIELDS,
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,7 +46,9 @@ public class BotsRepository extends EntityRepository<Bots> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restorePatchAttributes(Bots original, Bots update) {}
|
||||
public void restorePatchAttributes(Bots original, Bots update) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityInterface<Bots> getEntityInterface(Bots entity) {
|
||||
@ -53,15 +56,19 @@ public class BotsRepository extends EntityRepository<Bots> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(Bots entity) {}
|
||||
|
||||
@Override
|
||||
public void storeEntity(Bots entity, boolean update) throws IOException {
|
||||
daoCollection.botsDAO().insert(entity);
|
||||
public void prepare(Bots entity) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeRelationships(Bots entity) {}
|
||||
public void storeEntity(Bots entity, boolean update) throws IOException {
|
||||
store(entity.getId(), entity, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeRelationships(Bots entity) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
public static class BotsEntityInterface implements EntityInterface<Bots> {
|
||||
private final Bots entity;
|
||||
@ -85,21 +92,11 @@ public class BotsRepository extends EntityRepository<Bots> {
|
||||
return entity.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullyQualifiedName() {
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getVersion() {
|
||||
return entity.getVersion();
|
||||
@ -120,11 +117,6 @@ public class BotsRepository extends EntityRepository<Bots> {
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("Dashboard service does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
@ -177,9 +169,6 @@ public class BotsRepository extends EntityRepository<Bots> {
|
||||
entity.setChangeDescription(changeDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(EntityReference owner) {}
|
||||
|
||||
@Override
|
||||
public void setDeleted(boolean flag) {
|
||||
entity.setDeleted(flag);
|
||||
@ -189,8 +178,5 @@ public class BotsRepository extends EntityRepository<Bots> {
|
||||
public Bots withHref(URI href) {
|
||||
return entity.withHref(href);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
|
||||
public class ChartRepository extends EntityRepository<Chart> {
|
||||
private static final Fields CHART_UPDATE_FIELDS = new Fields(ChartResource.FIELD_LIST, "owner");
|
||||
@ -45,7 +44,10 @@ public class ChartRepository extends EntityRepository<Chart> {
|
||||
dao.chartDAO(),
|
||||
dao,
|
||||
CHART_PATCH_FIELDS,
|
||||
CHART_UPDATE_FIELDS);
|
||||
CHART_UPDATE_FIELDS,
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
public static String getFQN(Chart chart) {
|
||||
@ -71,11 +73,7 @@ public class ChartRepository extends EntityRepository<Chart> {
|
||||
// Don't store owner, database, href and tags as JSON. Build it on the fly based on relationships
|
||||
chart.withOwner(null).withService(null).withHref(null).withTags(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.chartDAO().update(chart.getId(), JsonUtils.pojoToJson(chart));
|
||||
} else {
|
||||
daoCollection.chartDAO().insert(chart);
|
||||
}
|
||||
store(chart.getId(), chart, update);
|
||||
|
||||
// Restore the relationships
|
||||
chart.withOwner(owner).withService(service).withTags(tags);
|
||||
@ -96,25 +94,6 @@ public class ChartRepository extends EntityRepository<Chart> {
|
||||
applyTags(chart);
|
||||
}
|
||||
|
||||
private void applyTags(Chart chart) {
|
||||
// Add chart level tags by adding tag to chart relationship
|
||||
EntityUtil.applyTags(daoCollection.tagDAO(), chart.getTags(), chart.getFullyQualifiedName());
|
||||
chart.setTags(getTags(chart.getFullyQualifiedName())); // Update tag to handle additional derived tags
|
||||
}
|
||||
|
||||
public EntityReference getOwner(Chart chart) throws IOException {
|
||||
return chart != null
|
||||
? EntityUtil.populateOwner(
|
||||
chart.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO())
|
||||
: null;
|
||||
}
|
||||
|
||||
private void setOwner(Chart chart, EntityReference owner) {
|
||||
EntityUtil.setOwner(daoCollection.relationshipDAO(), chart.getId(), Entity.CHART, owner);
|
||||
// TODO not required
|
||||
chart.setOwner(owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Chart setFields(Chart chart, Fields fields) throws IOException {
|
||||
chart.setService(getService(chart));
|
||||
@ -139,16 +118,6 @@ public class ChartRepository extends EntityRepository<Chart> {
|
||||
return new ChartEntityInterface(entity);
|
||||
}
|
||||
|
||||
private List<EntityReference> getFollowers(Chart chart) throws IOException {
|
||||
return chart == null
|
||||
? null
|
||||
: EntityUtil.getFollowers(chart.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO());
|
||||
}
|
||||
|
||||
private List<TagLabel> getTags(String fqn) {
|
||||
return daoCollection.tagDAO().getTags(fqn);
|
||||
}
|
||||
|
||||
private EntityReference getService(Chart chart) throws IOException {
|
||||
EntityReference ref =
|
||||
EntityUtil.getService(daoCollection.relationshipDAO(), chart.getId(), Entity.DASHBOARD_SERVICE);
|
||||
|
@ -35,7 +35,6 @@ import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
|
||||
public class DashboardRepository extends EntityRepository<Dashboard> {
|
||||
private static final Fields DASHBOARD_UPDATE_FIELDS = new Fields(DashboardResource.FIELD_LIST, "owner,tags,charts");
|
||||
@ -49,7 +48,10 @@ public class DashboardRepository extends EntityRepository<Dashboard> {
|
||||
dao.dashboardDAO(),
|
||||
dao,
|
||||
DASHBOARD_PATCH_FIELDS,
|
||||
DASHBOARD_UPDATE_FIELDS);
|
||||
DASHBOARD_UPDATE_FIELDS,
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
public static String getFQN(Dashboard dashboard) {
|
||||
@ -92,10 +94,6 @@ public class DashboardRepository extends EntityRepository<Dashboard> {
|
||||
.withId(original.getId());
|
||||
}
|
||||
|
||||
private List<TagLabel> getTags(String fqn) {
|
||||
return daoCollection.tagDAO().getTags(fqn);
|
||||
}
|
||||
|
||||
private EntityReference getService(Dashboard dashboard) throws IOException {
|
||||
EntityReference ref =
|
||||
EntityUtil.getService(daoCollection.relationshipDAO(), dashboard.getId(), Entity.DASHBOARD_SERVICE);
|
||||
@ -154,11 +152,7 @@ public class DashboardRepository extends EntityRepository<Dashboard> {
|
||||
// Don't store owner, database, href and tags as JSON. Build it on the fly based on relationships
|
||||
dashboard.withOwner(null).withHref(null).withTags(null).withService(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.dashboardDAO().update(dashboard.getId(), JsonUtils.pojoToJson(dashboard));
|
||||
} else {
|
||||
daoCollection.dashboardDAO().insert(dashboard);
|
||||
}
|
||||
store(dashboard.getId(), dashboard, update);
|
||||
|
||||
// Restore the relationships
|
||||
dashboard.withOwner(owner).withTags(tags).withService(service);
|
||||
@ -189,30 +183,6 @@ public class DashboardRepository extends EntityRepository<Dashboard> {
|
||||
return new DashboardUpdater(original, updated, patchOperation);
|
||||
}
|
||||
|
||||
private EntityReference getOwner(Dashboard dashboard) throws IOException {
|
||||
return dashboard == null
|
||||
? null
|
||||
: EntityUtil.populateOwner(
|
||||
dashboard.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO());
|
||||
}
|
||||
|
||||
public void setOwner(Dashboard dashboard, EntityReference owner) {
|
||||
EntityUtil.setOwner(daoCollection.relationshipDAO(), dashboard.getId(), Entity.DASHBOARD, owner);
|
||||
dashboard.setOwner(owner);
|
||||
}
|
||||
|
||||
private void applyTags(Dashboard dashboard) {
|
||||
// Add dashboard level tags by adding tag to dashboard relationship
|
||||
EntityUtil.applyTags(daoCollection.tagDAO(), dashboard.getTags(), dashboard.getFullyQualifiedName());
|
||||
dashboard.setTags(getTags(dashboard.getFullyQualifiedName())); // Update tag to handle additional derived tags
|
||||
}
|
||||
|
||||
private List<EntityReference> getFollowers(Dashboard dashboard) throws IOException {
|
||||
return dashboard == null
|
||||
? null
|
||||
: EntityUtil.getFollowers(dashboard.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO());
|
||||
}
|
||||
|
||||
private List<EntityReference> getCharts(Dashboard dashboard) throws IOException {
|
||||
if (dashboard == null) {
|
||||
return null;
|
||||
|
@ -17,7 +17,6 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import org.openmetadata.catalog.Entity;
|
||||
@ -26,7 +25,6 @@ import org.openmetadata.catalog.resources.services.dashboard.DashboardServiceRes
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.Schedule;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
@ -41,7 +39,10 @@ public class DashboardServiceRepository extends EntityRepository<DashboardServic
|
||||
dao.dashboardServiceDAO(),
|
||||
dao,
|
||||
Fields.EMPTY_FIELDS,
|
||||
Fields.EMPTY_FIELDS);
|
||||
Fields.EMPTY_FIELDS,
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
public DashboardService update(
|
||||
@ -123,21 +124,11 @@ public class DashboardServiceRepository extends EntityRepository<DashboardServic
|
||||
return entity.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullyQualifiedName() {
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getVersion() {
|
||||
return entity.getVersion();
|
||||
@ -158,11 +149,6 @@ public class DashboardServiceRepository extends EntityRepository<DashboardServic
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("Dashboard service does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
@ -183,11 +169,6 @@ public class DashboardServiceRepository extends EntityRepository<DashboardServic
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
entity.setId(id);
|
||||
@ -215,9 +196,6 @@ public class DashboardServiceRepository extends EntityRepository<DashboardServic
|
||||
entity.setChangeDescription(changeDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(EntityReference owner) {}
|
||||
|
||||
@Override
|
||||
public void setDeleted(boolean flag) {
|
||||
entity.setDeleted(flag);
|
||||
@ -227,9 +205,6 @@ public class DashboardServiceRepository extends EntityRepository<DashboardServic
|
||||
public DashboardService withHref(URI href) {
|
||||
return entity.withHref(href);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {}
|
||||
}
|
||||
|
||||
public class DashboardServiceUpdater extends EntityUpdater {
|
||||
|
@ -31,7 +31,6 @@ import org.openmetadata.catalog.jdbi3.DatabaseServiceRepository.DatabaseServiceE
|
||||
import org.openmetadata.catalog.resources.databases.DatabaseResource;
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
@ -49,7 +48,10 @@ public class DatabaseRepository extends EntityRepository<Database> {
|
||||
dao.databaseDAO(),
|
||||
dao,
|
||||
DATABASE_PATCH_FIELDS,
|
||||
DATABASE_UPDATE_FIELDS);
|
||||
DATABASE_UPDATE_FIELDS,
|
||||
false,
|
||||
true,
|
||||
false);
|
||||
}
|
||||
|
||||
public static String getFQN(Database database) {
|
||||
@ -102,13 +104,6 @@ public class DatabaseRepository extends EntityRepository<Database> {
|
||||
EntityUtil.setOwner(daoCollection.relationshipDAO(), database.getId(), Entity.DATABASE, database.getOwner());
|
||||
}
|
||||
|
||||
public EntityReference getOwner(Database database) throws IOException {
|
||||
return database != null
|
||||
? EntityUtil.populateOwner(
|
||||
database.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO())
|
||||
: null;
|
||||
}
|
||||
|
||||
private List<EntityReference> getTables(Database database) throws IOException {
|
||||
if (database == null) {
|
||||
return null;
|
||||
@ -232,11 +227,6 @@ public class DatabaseRepository extends EntityRepository<Database> {
|
||||
return entity.getFullyQualifiedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getVersion() {
|
||||
return entity.getVersion();
|
||||
@ -257,11 +247,6 @@ public class DatabaseRepository extends EntityRepository<Database> {
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("Database does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getEntityReference() {
|
||||
return new EntityReference()
|
||||
@ -328,8 +313,5 @@ public class DatabaseRepository extends EntityRepository<Database> {
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.openmetadata.catalog.Entity;
|
||||
import org.openmetadata.catalog.entity.services.DatabaseService;
|
||||
@ -25,11 +24,9 @@ import org.openmetadata.catalog.resources.services.database.DatabaseServiceResou
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.JdbcInfo;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
|
||||
public class DatabaseServiceRepository extends EntityRepository<DatabaseService> {
|
||||
public static final String COLLECTION_PATH = "v1/services/databaseServices";
|
||||
@ -42,7 +39,10 @@ public class DatabaseServiceRepository extends EntityRepository<DatabaseService>
|
||||
dao.dbServiceDAO(),
|
||||
dao,
|
||||
Fields.EMPTY_FIELDS,
|
||||
Fields.EMPTY_FIELDS);
|
||||
Fields.EMPTY_FIELDS,
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,7 +51,9 @@ public class DatabaseServiceRepository extends EntityRepository<DatabaseService>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restorePatchAttributes(DatabaseService original, DatabaseService updated) {}
|
||||
public void restorePatchAttributes(DatabaseService original, DatabaseService updated) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityInterface<DatabaseService> getEntityInterface(DatabaseService entity) {
|
||||
@ -65,15 +67,14 @@ public class DatabaseServiceRepository extends EntityRepository<DatabaseService>
|
||||
|
||||
@Override
|
||||
public void storeEntity(DatabaseService service, boolean update) throws IOException {
|
||||
if (update) {
|
||||
daoCollection.dbServiceDAO().update(service.getId(), JsonUtils.pojoToJson(service));
|
||||
} else {
|
||||
daoCollection.dbServiceDAO().insert(service);
|
||||
}
|
||||
service.withHref(null);
|
||||
store(service.getId(), service, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeRelationships(DatabaseService entity) {}
|
||||
public void storeRelationships(DatabaseService entity) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityUpdater getUpdater(DatabaseService original, DatabaseService updated, boolean patchOperation) {
|
||||
@ -102,21 +103,11 @@ public class DatabaseServiceRepository extends EntityRepository<DatabaseService>
|
||||
return entity.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullyQualifiedName() {
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getVersion() {
|
||||
return entity.getVersion();
|
||||
@ -137,11 +128,6 @@ public class DatabaseServiceRepository extends EntityRepository<DatabaseService>
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("Database service does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
@ -162,11 +148,6 @@ public class DatabaseServiceRepository extends EntityRepository<DatabaseService>
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
entity.setId(id);
|
||||
@ -194,9 +175,6 @@ public class DatabaseServiceRepository extends EntityRepository<DatabaseService>
|
||||
entity.setChangeDescription(changeDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(EntityReference owner) {}
|
||||
|
||||
@Override
|
||||
public void setDeleted(boolean flag) {
|
||||
entity.setDeleted(flag);
|
||||
@ -206,9 +184,6 @@ public class DatabaseServiceRepository extends EntityRepository<DatabaseService>
|
||||
public DatabaseService withHref(URI href) {
|
||||
return entity.withHref(href);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {}
|
||||
}
|
||||
|
||||
public class DatabaseServiceUpdater extends EntityUpdater {
|
||||
|
@ -98,6 +98,9 @@ public abstract class EntityRepository<T> {
|
||||
protected final EntityDAO<T> dao;
|
||||
protected final CollectionDAO daoCollection;
|
||||
protected boolean softDelete = true;
|
||||
protected final boolean supportsTags;
|
||||
protected final boolean supportsOwner;
|
||||
protected final boolean supportsFollower;
|
||||
|
||||
/** Fields that can be updated during PATCH operation */
|
||||
private final Fields patchFields;
|
||||
@ -112,7 +115,10 @@ public abstract class EntityRepository<T> {
|
||||
EntityDAO<T> entityDAO,
|
||||
CollectionDAO collectionDAO,
|
||||
Fields patchFields,
|
||||
Fields putFields) {
|
||||
Fields putFields,
|
||||
boolean supportsTags,
|
||||
boolean supportsOwner,
|
||||
boolean supportsFollower) {
|
||||
this.collectionPath = collectionPath;
|
||||
this.entityClass = entityClass;
|
||||
this.dao = entityDAO;
|
||||
@ -120,6 +126,9 @@ public abstract class EntityRepository<T> {
|
||||
this.patchFields = patchFields;
|
||||
this.putFields = putFields;
|
||||
this.entityName = entityName;
|
||||
this.supportsTags = supportsTags;
|
||||
this.supportsOwner = supportsOwner;
|
||||
this.supportsFollower = supportsFollower;
|
||||
Entity.registerEntity(entityName, dao, this);
|
||||
}
|
||||
|
||||
@ -436,6 +445,51 @@ public abstract class EntityRepository<T> {
|
||||
return entity;
|
||||
}
|
||||
|
||||
protected void store(UUID id, T entity, boolean update) throws JsonProcessingException {
|
||||
if (update) {
|
||||
dao.update(id, JsonUtils.pojoToJson(entity));
|
||||
} else {
|
||||
dao.insert(entity);
|
||||
}
|
||||
}
|
||||
|
||||
protected EntityReference getOwner(T entity) throws IOException {
|
||||
EntityInterface entityInterface = getEntityInterface(entity);
|
||||
return supportsOwner && entity != null
|
||||
? EntityUtil.populateOwner(
|
||||
entityInterface.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO())
|
||||
: null;
|
||||
}
|
||||
|
||||
protected void setOwner(T entity, EntityReference owner) {
|
||||
if (supportsOwner) {
|
||||
EntityInterface<T> entityInterface = getEntityInterface(entity);
|
||||
EntityUtil.setOwner(daoCollection.relationshipDAO(), entityInterface.getId(), entityName, owner);
|
||||
entityInterface.setOwner(owner);
|
||||
}
|
||||
}
|
||||
|
||||
protected void applyTags(T entity) {
|
||||
if (supportsTags) {
|
||||
// Add entity level tags by adding tag to the entity relationship
|
||||
EntityInterface<T> entityInterface = getEntityInterface(entity);
|
||||
EntityUtil.applyTags(daoCollection.tagDAO(), entityInterface.getTags(), entityInterface.getFullyQualifiedName());
|
||||
// Update tag to handle additional derived tags
|
||||
entityInterface.setTags(getTags(entityInterface.getFullyQualifiedName()));
|
||||
}
|
||||
}
|
||||
|
||||
protected List<TagLabel> getTags(String fqn) {
|
||||
return !supportsOwner ? null : daoCollection.tagDAO().getTags(fqn);
|
||||
}
|
||||
|
||||
protected List<EntityReference> getFollowers(T entity) throws IOException {
|
||||
EntityInterface<T> entityInterface = getEntityInterface(entity);
|
||||
return !supportsFollower || entity == null
|
||||
? null
|
||||
: EntityUtil.getFollowers(entityInterface.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO());
|
||||
}
|
||||
|
||||
public T withHref(UriInfo uriInfo, T entity) {
|
||||
if (uriInfo == null) {
|
||||
return entity;
|
||||
|
@ -30,7 +30,6 @@ import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
|
||||
public class IngestionRepository extends EntityRepository<Ingestion> {
|
||||
private static final Fields INGESTION_UPDATE_FIELDS =
|
||||
@ -46,7 +45,10 @@ public class IngestionRepository extends EntityRepository<Ingestion> {
|
||||
dao.ingestionDAO(),
|
||||
dao,
|
||||
INGESTION_PATCH_FIELDS,
|
||||
INGESTION_UPDATE_FIELDS);
|
||||
INGESTION_UPDATE_FIELDS,
|
||||
true,
|
||||
true,
|
||||
false);
|
||||
}
|
||||
|
||||
public static String getFQN(Ingestion ingestion) {
|
||||
@ -77,10 +79,6 @@ public class IngestionRepository extends EntityRepository<Ingestion> {
|
||||
return new IngestionEntityInterface(entity);
|
||||
}
|
||||
|
||||
private List<TagLabel> getTags(String fqn) {
|
||||
return daoCollection.tagDAO().getTags(fqn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(Ingestion ingestion) throws IOException {
|
||||
ingestion.setService(getService(ingestion.getService()));
|
||||
@ -100,11 +98,7 @@ public class IngestionRepository extends EntityRepository<Ingestion> {
|
||||
// Don't store owner, dashboard, href and tags as JSON. Build it on the fly based on relationships
|
||||
ingestion.withOwner(null).withHref(null).withTags(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.ingestionDAO().update(ingestion.getId(), JsonUtils.pojoToJson(ingestion));
|
||||
} else {
|
||||
daoCollection.ingestionDAO().insert(ingestion);
|
||||
}
|
||||
store(ingestion.getId(), ingestion, update);
|
||||
|
||||
// Restore the relationships
|
||||
ingestion.withOwner(owner).withService(service).withTags(tags);
|
||||
@ -130,24 +124,6 @@ public class IngestionRepository extends EntityRepository<Ingestion> {
|
||||
return new IngestionUpdater(original, updated, patchOperation);
|
||||
}
|
||||
|
||||
private EntityReference getOwner(Ingestion ingestion) throws IOException {
|
||||
return ingestion == null
|
||||
? null
|
||||
: EntityUtil.populateOwner(
|
||||
ingestion.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO());
|
||||
}
|
||||
|
||||
public void setOwner(Ingestion ingestion, EntityReference owner) {
|
||||
EntityUtil.setOwner(daoCollection.relationshipDAO(), ingestion.getId(), Entity.INGESTION, owner);
|
||||
ingestion.setOwner(owner);
|
||||
}
|
||||
|
||||
private void applyTags(Ingestion ingestion) {
|
||||
// Add ingestion level tags by adding tag to ingestion relationship
|
||||
EntityUtil.applyTags(daoCollection.tagDAO(), ingestion.getTags(), ingestion.getFullyQualifiedName());
|
||||
ingestion.setTags(getTags(ingestion.getFullyQualifiedName())); // Update tag to handle additional derived tags
|
||||
}
|
||||
|
||||
private EntityReference getService(Ingestion ingestion) throws IOException {
|
||||
EntityReference ref = EntityUtil.getService(daoCollection.relationshipDAO(), ingestion.getId());
|
||||
return getService(Objects.requireNonNull(ref));
|
||||
@ -245,12 +221,6 @@ public class IngestionRepository extends EntityRepository<Ingestion> {
|
||||
return entity.getService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
// Ingestion does not have followers.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
entity.setId(id);
|
||||
|
@ -51,7 +51,10 @@ public class LocationRepository extends EntityRepository<Location> {
|
||||
dao.locationDAO(),
|
||||
dao,
|
||||
LOCATION_PATCH_FIELDS,
|
||||
LOCATION_UPDATE_FIELDS);
|
||||
LOCATION_UPDATE_FIELDS,
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -185,11 +188,7 @@ public class LocationRepository extends EntityRepository<Location> {
|
||||
// Don't store owner, href and tags as JSON. Build it on the fly based on relationships
|
||||
location.withOwner(null).withService(null).withHref(null).withTags(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.locationDAO().update(location.getId(), JsonUtils.pojoToJson(location));
|
||||
} else {
|
||||
daoCollection.locationDAO().insert(location);
|
||||
}
|
||||
store(location.getId(), location, update);
|
||||
|
||||
// Restore the relationships
|
||||
location.withOwner(owner).withService(service).withTags(tags);
|
||||
@ -217,19 +216,6 @@ public class LocationRepository extends EntityRepository<Location> {
|
||||
return new LocationUpdater(original, updated, patchOperation);
|
||||
}
|
||||
|
||||
public EntityReference getOwner(Location location) throws IOException {
|
||||
return location != null
|
||||
? EntityUtil.populateOwner(
|
||||
location.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO())
|
||||
: null;
|
||||
}
|
||||
|
||||
private List<EntityReference> getFollowers(Location location) throws IOException {
|
||||
return location == null
|
||||
? null
|
||||
: EntityUtil.getFollowers(location.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO());
|
||||
}
|
||||
|
||||
private EntityReference getService(Location location) throws IOException {
|
||||
EntityReference ref =
|
||||
EntityUtil.getService(daoCollection.relationshipDAO(), location.getId(), Entity.STORAGE_SERVICE);
|
||||
@ -259,16 +245,6 @@ public class LocationRepository extends EntityRepository<Location> {
|
||||
}
|
||||
}
|
||||
|
||||
private void applyTags(Location location) {
|
||||
// Add location level tags by adding tag to location relationship
|
||||
EntityUtil.applyTags(daoCollection.tagDAO(), location.getTags(), location.getFullyQualifiedName());
|
||||
location.setTags(getTags(location.getFullyQualifiedName())); // Update tag to handle additional derived tags
|
||||
}
|
||||
|
||||
private List<TagLabel> getTags(String fqn) {
|
||||
return daoCollection.tagDAO().getTags(fqn);
|
||||
}
|
||||
|
||||
public static class LocationEntityInterface implements EntityInterface<Location> {
|
||||
private final Location entity;
|
||||
|
||||
|
@ -25,11 +25,9 @@ import org.openmetadata.catalog.entity.services.MessagingService;
|
||||
import org.openmetadata.catalog.resources.services.messaging.MessagingServiceResource;
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
|
||||
public class MessagingServiceRepository extends EntityRepository<MessagingService> {
|
||||
|
||||
@ -41,7 +39,10 @@ public class MessagingServiceRepository extends EntityRepository<MessagingServic
|
||||
dao.messagingServiceDAO(),
|
||||
dao,
|
||||
Fields.EMPTY_FIELDS,
|
||||
Fields.EMPTY_FIELDS);
|
||||
Fields.EMPTY_FIELDS,
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,7 +51,9 @@ public class MessagingServiceRepository extends EntityRepository<MessagingServic
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restorePatchAttributes(MessagingService original, MessagingService updated) {}
|
||||
public void restorePatchAttributes(MessagingService original, MessagingService updated) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityInterface<MessagingService> getEntityInterface(MessagingService entity) {
|
||||
@ -64,15 +67,14 @@ public class MessagingServiceRepository extends EntityRepository<MessagingServic
|
||||
|
||||
@Override
|
||||
public void storeEntity(MessagingService service, boolean update) throws IOException {
|
||||
if (update) {
|
||||
daoCollection.messagingServiceDAO().update(service.getId(), JsonUtils.pojoToJson(service));
|
||||
} else {
|
||||
daoCollection.messagingServiceDAO().insert(service);
|
||||
}
|
||||
service.withHref(null);
|
||||
store(service.getId(), service, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeRelationships(MessagingService entity) {}
|
||||
public void storeRelationships(MessagingService entity) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityUpdater getUpdater(MessagingService original, MessagingService updated, boolean patchOperation) {
|
||||
@ -101,21 +103,11 @@ public class MessagingServiceRepository extends EntityRepository<MessagingServic
|
||||
return entity.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullyQualifiedName() {
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getVersion() {
|
||||
return entity.getVersion();
|
||||
@ -136,11 +128,6 @@ public class MessagingServiceRepository extends EntityRepository<MessagingServic
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("Messaging service does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
@ -161,11 +148,6 @@ public class MessagingServiceRepository extends EntityRepository<MessagingServic
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
entity.setId(id);
|
||||
@ -193,9 +175,6 @@ public class MessagingServiceRepository extends EntityRepository<MessagingServic
|
||||
entity.setChangeDescription(changeDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(EntityReference owner) {}
|
||||
|
||||
@Override
|
||||
public void setDeleted(boolean flag) {
|
||||
entity.setDeleted(flag);
|
||||
@ -205,9 +184,6 @@ public class MessagingServiceRepository extends EntityRepository<MessagingServic
|
||||
public MessagingService withHref(URI href) {
|
||||
return entity.withHref(href);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {}
|
||||
}
|
||||
|
||||
public class MessagingServiceUpdater extends EntityUpdater {
|
||||
|
@ -29,7 +29,6 @@ import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
|
||||
public class MetricsRepository extends EntityRepository<Metrics> {
|
||||
private static final Fields METRICS_UPDATE_FIELDS = new Fields(MetricsResource.FIELD_LIST, "owner");
|
||||
@ -42,7 +41,10 @@ public class MetricsRepository extends EntityRepository<Metrics> {
|
||||
dao.metricsDAO(),
|
||||
dao,
|
||||
Fields.EMPTY_FIELDS,
|
||||
METRICS_UPDATE_FIELDS);
|
||||
METRICS_UPDATE_FIELDS,
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
public static String getFQN(Metrics metrics) {
|
||||
@ -59,7 +61,9 @@ public class MetricsRepository extends EntityRepository<Metrics> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restorePatchAttributes(Metrics original, Metrics updated) {}
|
||||
public void restorePatchAttributes(Metrics original, Metrics updated) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityInterface<Metrics> getEntityInterface(Metrics entity) {
|
||||
@ -84,11 +88,7 @@ public class MetricsRepository extends EntityRepository<Metrics> {
|
||||
// Don't store owner, database, href and tags as JSON. Build it on the fly based on relationships
|
||||
metrics.withOwner(null).withService(null).withHref(null).withTags(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.metricsDAO().update(metrics.getId(), JsonUtils.pojoToJson(metrics));
|
||||
} else {
|
||||
daoCollection.metricsDAO().insert(metrics);
|
||||
}
|
||||
store(metrics.getId(), metrics, update);
|
||||
|
||||
// Restore the relationships
|
||||
metrics.withOwner(owner).withService(service).withTags(tags);
|
||||
@ -121,28 +121,6 @@ public class MetricsRepository extends EntityRepository<Metrics> {
|
||||
throw new IllegalArgumentException(CatalogExceptionMessage.invalidServiceEntity(service.getType(), Entity.METRICS));
|
||||
}
|
||||
|
||||
private EntityReference getOwner(Metrics metrics) throws IOException {
|
||||
return metrics == null
|
||||
? null
|
||||
: EntityUtil.populateOwner(
|
||||
metrics.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO());
|
||||
}
|
||||
|
||||
public void setOwner(Metrics metrics, EntityReference owner) {
|
||||
EntityUtil.setOwner(daoCollection.relationshipDAO(), metrics.getId(), Entity.METRICS, owner);
|
||||
metrics.setOwner(owner);
|
||||
}
|
||||
|
||||
private void applyTags(Metrics metrics) {
|
||||
// Add chart level tags by adding tag to chart relationship
|
||||
EntityUtil.applyTags(daoCollection.tagDAO(), metrics.getTags(), metrics.getFullyQualifiedName());
|
||||
metrics.setTags(getTags(metrics.getFullyQualifiedName())); // Update tag to handle additional derived tags
|
||||
}
|
||||
|
||||
private List<TagLabel> getTags(String fqn) {
|
||||
return daoCollection.tagDAO().getTags(fqn);
|
||||
}
|
||||
|
||||
static class MetricsEntityInterface implements EntityInterface<Metrics> {
|
||||
private final Metrics entity;
|
||||
|
||||
@ -200,11 +178,6 @@ public class MetricsRepository extends EntityRepository<Metrics> {
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("Metrics does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
@ -222,7 +195,7 @@ public class MetricsRepository extends EntityRepository<Metrics> {
|
||||
|
||||
@Override
|
||||
public Metrics getEntity() {
|
||||
return null;
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -231,7 +204,9 @@ public class MetricsRepository extends EntityRepository<Metrics> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {}
|
||||
public void setId(UUID id) {
|
||||
entity.setId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(String description) {
|
||||
|
@ -37,7 +37,6 @@ import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -57,7 +56,10 @@ public class MlModelRepository extends EntityRepository<MlModel> {
|
||||
dao.mlModelDAO(),
|
||||
dao,
|
||||
MODEL_PATCH_FIELDS,
|
||||
MODEL_UPDATE_FIELDS);
|
||||
MODEL_UPDATE_FIELDS,
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
public static String getFQN(MlModel model) {
|
||||
@ -99,10 +101,6 @@ public class MlModelRepository extends EntityRepository<MlModel> {
|
||||
return new MlModelEntityInterface(entity);
|
||||
}
|
||||
|
||||
private List<TagLabel> getTags(String fqn) {
|
||||
return daoCollection.tagDAO().getTags(fqn);
|
||||
}
|
||||
|
||||
private void setMlFeatureSourcesFQN(List<MlFeatureSource> mlSources) {
|
||||
mlSources.forEach(
|
||||
s -> {
|
||||
@ -172,11 +170,7 @@ public class MlModelRepository extends EntityRepository<MlModel> {
|
||||
// Don't store owner, dashboard, href and tags as JSON. Build it on the fly based on relationships
|
||||
mlModel.withOwner(null).withDashboard(null).withHref(null).withTags(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.mlModelDAO().update(mlModel.getId(), JsonUtils.pojoToJson(mlModel));
|
||||
} else {
|
||||
daoCollection.mlModelDAO().insert(mlModel);
|
||||
}
|
||||
store(mlModel.getId(), mlModel, update);
|
||||
|
||||
// Restore the relationships
|
||||
mlModel.withOwner(owner).withDashboard(dashboard).withTags(tags);
|
||||
@ -206,13 +200,6 @@ public class MlModelRepository extends EntityRepository<MlModel> {
|
||||
return new MlModelUpdater(original, updated, patchOperation);
|
||||
}
|
||||
|
||||
private EntityReference getOwner(MlModel mlModel) throws IOException {
|
||||
return mlModel == null
|
||||
? null
|
||||
: EntityUtil.populateOwner(
|
||||
mlModel.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO());
|
||||
}
|
||||
|
||||
private EntityReference getDashboard(MlModel mlModel) throws IOException {
|
||||
if (mlModel != null) {
|
||||
List<EntityReference> ids =
|
||||
@ -247,18 +234,6 @@ public class MlModelRepository extends EntityRepository<MlModel> {
|
||||
.deleteFrom(mlModel.getId().toString(), Relationship.USES.ordinal(), Entity.DASHBOARD);
|
||||
}
|
||||
|
||||
private void applyTags(MlModel mlModel) {
|
||||
// Add model level tags by adding tag to model relationship
|
||||
EntityUtil.applyTags(daoCollection.tagDAO(), mlModel.getTags(), mlModel.getFullyQualifiedName());
|
||||
mlModel.setTags(getTags(mlModel.getFullyQualifiedName())); // Update tag to handle additional derived tags
|
||||
}
|
||||
|
||||
private List<EntityReference> getFollowers(MlModel model) throws IOException {
|
||||
return model == null
|
||||
? null
|
||||
: EntityUtil.getFollowers(model.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO());
|
||||
}
|
||||
|
||||
public static class MlModelEntityInterface implements EntityInterface<MlModel> {
|
||||
private final MlModel entity;
|
||||
|
||||
|
@ -38,7 +38,6 @@ import org.openmetadata.catalog.type.Task;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
|
||||
public class PipelineRepository extends EntityRepository<Pipeline> {
|
||||
private static final Fields PIPELINE_UPDATE_FIELDS = new Fields(PipelineResource.FIELD_LIST, "owner,tags,tasks");
|
||||
@ -52,7 +51,10 @@ public class PipelineRepository extends EntityRepository<Pipeline> {
|
||||
dao.pipelineDAO(),
|
||||
dao,
|
||||
PIPELINE_PATCH_FIELDS,
|
||||
PIPELINE_UPDATE_FIELDS);
|
||||
PIPELINE_UPDATE_FIELDS,
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
public static String getFQN(Pipeline pipeline) {
|
||||
@ -95,10 +97,6 @@ public class PipelineRepository extends EntityRepository<Pipeline> {
|
||||
return new PipelineEntityInterface(entity);
|
||||
}
|
||||
|
||||
private List<TagLabel> getTags(String fqn) {
|
||||
return daoCollection.tagDAO().getTags(fqn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(Pipeline pipeline) throws IOException {
|
||||
populateService(pipeline);
|
||||
@ -117,11 +115,7 @@ public class PipelineRepository extends EntityRepository<Pipeline> {
|
||||
// Don't store owner, database, href and tags as JSON. Build it on the fly based on relationships
|
||||
pipeline.withOwner(null).withService(null).withHref(null).withTags(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.pipelineDAO().update(pipeline.getId(), JsonUtils.pojoToJson(pipeline));
|
||||
} else {
|
||||
daoCollection.pipelineDAO().insert(pipeline);
|
||||
}
|
||||
store(pipeline.getId(), pipeline, update);
|
||||
|
||||
// Restore the relationships
|
||||
pipeline.withOwner(owner).withService(service).withTags(tags);
|
||||
@ -173,30 +167,6 @@ public class PipelineRepository extends EntityRepository<Pipeline> {
|
||||
throw new IllegalArgumentException(CatalogExceptionMessage.invalidServiceEntity(entityType, Entity.PIPELINE));
|
||||
}
|
||||
|
||||
private EntityReference getOwner(Pipeline pipeline) throws IOException {
|
||||
return pipeline == null
|
||||
? null
|
||||
: EntityUtil.populateOwner(
|
||||
pipeline.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO());
|
||||
}
|
||||
|
||||
public void setOwner(Pipeline pipeline, EntityReference owner) {
|
||||
EntityUtil.setOwner(daoCollection.relationshipDAO(), pipeline.getId(), Entity.PIPELINE, owner);
|
||||
pipeline.setOwner(owner);
|
||||
}
|
||||
|
||||
private void applyTags(Pipeline pipeline) {
|
||||
// Add pipeline level tags by adding tag to pipeline relationship
|
||||
EntityUtil.applyTags(daoCollection.tagDAO(), pipeline.getTags(), pipeline.getFullyQualifiedName());
|
||||
pipeline.setTags(getTags(pipeline.getFullyQualifiedName())); // Update tag to handle additional derived tags
|
||||
}
|
||||
|
||||
private List<EntityReference> getFollowers(Pipeline pipeline) throws IOException {
|
||||
return pipeline == null
|
||||
? null
|
||||
: EntityUtil.getFollowers(pipeline.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO());
|
||||
}
|
||||
|
||||
public static class PipelineEntityInterface implements EntityInterface<Pipeline> {
|
||||
private final Pipeline entity;
|
||||
|
||||
|
@ -16,14 +16,12 @@ package org.openmetadata.catalog.jdbi3;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.openmetadata.catalog.Entity;
|
||||
import org.openmetadata.catalog.entity.services.PipelineService;
|
||||
import org.openmetadata.catalog.resources.services.pipeline.PipelineServiceResource;
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
@ -38,7 +36,10 @@ public class PipelineServiceRepository extends EntityRepository<PipelineService>
|
||||
dao.pipelineServiceDAO(),
|
||||
dao,
|
||||
Fields.EMPTY_FIELDS,
|
||||
Fields.EMPTY_FIELDS);
|
||||
Fields.EMPTY_FIELDS,
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,7 +48,9 @@ public class PipelineServiceRepository extends EntityRepository<PipelineService>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restorePatchAttributes(PipelineService original, PipelineService updated) {}
|
||||
public void restorePatchAttributes(PipelineService original, PipelineService updated) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityInterface<PipelineService> getEntityInterface(PipelineService entity) {
|
||||
@ -69,7 +72,9 @@ public class PipelineServiceRepository extends EntityRepository<PipelineService>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeRelationships(PipelineService entity) {}
|
||||
public void storeRelationships(PipelineService entity) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityUpdater getUpdater(PipelineService original, PipelineService updated, boolean patchOperation) {
|
||||
@ -98,21 +103,11 @@ public class PipelineServiceRepository extends EntityRepository<PipelineService>
|
||||
return entity.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullyQualifiedName() {
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getVersion() {
|
||||
return entity.getVersion();
|
||||
@ -133,11 +128,6 @@ public class PipelineServiceRepository extends EntityRepository<PipelineService>
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("Pipeline service does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
@ -158,11 +148,6 @@ public class PipelineServiceRepository extends EntityRepository<PipelineService>
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
entity.setId(id);
|
||||
@ -190,9 +175,6 @@ public class PipelineServiceRepository extends EntityRepository<PipelineService>
|
||||
entity.setChangeDescription(changeDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(EntityReference owner) {}
|
||||
|
||||
@Override
|
||||
public void setDeleted(boolean flag) {
|
||||
entity.setDeleted(flag);
|
||||
@ -202,9 +184,6 @@ public class PipelineServiceRepository extends EntityRepository<PipelineService>
|
||||
public PipelineService withHref(URI href) {
|
||||
return entity.withHref(href);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {}
|
||||
}
|
||||
|
||||
public class PipelineServiceUpdater extends EntityUpdater {
|
||||
|
@ -28,7 +28,6 @@ import org.openmetadata.catalog.resources.policies.PolicyResource;
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.PolicyType;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
@ -49,7 +48,10 @@ public class PolicyRepository extends EntityRepository<Policy> {
|
||||
dao.policyDAO(),
|
||||
dao,
|
||||
POLICY_PATCH_FIELDS,
|
||||
POLICY_UPDATE_FIELDS);
|
||||
POLICY_UPDATE_FIELDS,
|
||||
false,
|
||||
true,
|
||||
false);
|
||||
}
|
||||
|
||||
public static String getFQN(Policy policy) {
|
||||
@ -85,7 +87,9 @@ public class PolicyRepository extends EntityRepository<Policy> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restorePatchAttributes(Policy original, Policy updated) {}
|
||||
public void restorePatchAttributes(Policy original, Policy updated) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityInterface<Policy> getEntityInterface(Policy entity) {
|
||||
@ -125,11 +129,7 @@ public class PolicyRepository extends EntityRepository<Policy> {
|
||||
// Don't store owner, location and href as JSON. Build it on the fly based on relationships
|
||||
policy.withOwner(null).withLocation(null).withHref(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.policyDAO().update(policy.getId(), JsonUtils.pojoToJson(policy));
|
||||
} else {
|
||||
daoCollection.policyDAO().insert(policy);
|
||||
}
|
||||
store(policy.getId(), policy, update);
|
||||
|
||||
// Restore the relationships
|
||||
policy.withOwner(owner).withLocation(location).withHref(href);
|
||||
@ -182,18 +182,6 @@ public class PolicyRepository extends EntityRepository<Policy> {
|
||||
// No validation errors, if execution reaches here.
|
||||
}
|
||||
|
||||
private EntityReference getOwner(Policy policy) throws IOException {
|
||||
return policy == null
|
||||
? null
|
||||
: EntityUtil.populateOwner(
|
||||
policy.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO());
|
||||
}
|
||||
|
||||
private void setOwner(Policy policy, EntityReference owner) {
|
||||
EntityUtil.setOwner(daoCollection.relationshipDAO(), policy.getId(), Entity.POLICY, owner);
|
||||
policy.setOwner(owner);
|
||||
}
|
||||
|
||||
private void setLocation(Policy policy, EntityReference location) {
|
||||
if (location == null || location.getId() == null) {
|
||||
return;
|
||||
@ -240,12 +228,6 @@ public class PolicyRepository extends EntityRepository<Policy> {
|
||||
return entity.getFullyQualifiedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
// Policy does not have tags.
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Object> getRules() {
|
||||
return entity.getRules();
|
||||
}
|
||||
@ -270,12 +252,6 @@ public class PolicyRepository extends EntityRepository<Policy> {
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
// Policy does not have followers.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getEntityReference() {
|
||||
return new EntityReference()
|
||||
@ -291,11 +267,6 @@ public class PolicyRepository extends EntityRepository<Policy> {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
entity.setId(id);
|
||||
@ -323,11 +294,6 @@ public class PolicyRepository extends EntityRepository<Policy> {
|
||||
entity.setChangeDescription(changeDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {
|
||||
// Policy does not have tags.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(EntityReference owner) {
|
||||
entity.setOwner(owner);
|
||||
|
@ -39,7 +39,10 @@ public class ReportRepository extends EntityRepository<Report> {
|
||||
dao.reportDAO(),
|
||||
dao,
|
||||
Fields.EMPTY_FIELDS,
|
||||
REPORT_UPDATE_FIELDS);
|
||||
REPORT_UPDATE_FIELDS,
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,8 +71,8 @@ public class ReportRepository extends EntityRepository<Report> {
|
||||
|
||||
@Override
|
||||
public void storeEntity(Report report, boolean update) throws IOException {
|
||||
// TODO add right checks
|
||||
daoCollection.reportDAO().insert(report);
|
||||
report.setHref(null);
|
||||
store(report.getId(), report, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,18 +104,6 @@ public class ReportRepository extends EntityRepository<Report> {
|
||||
}
|
||||
}
|
||||
|
||||
private EntityReference getOwner(Report report) throws IOException {
|
||||
return report == null
|
||||
? null
|
||||
: EntityUtil.populateOwner(
|
||||
report.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO());
|
||||
}
|
||||
|
||||
public void setOwner(Report report, EntityReference owner) {
|
||||
EntityUtil.setOwner(daoCollection.relationshipDAO(), report.getId(), Entity.REPORT, owner);
|
||||
report.setOwner(owner);
|
||||
}
|
||||
|
||||
public static class ReportEntityInterface implements EntityInterface<Report> {
|
||||
private final Report entity;
|
||||
|
||||
@ -170,11 +161,6 @@ public class ReportRepository extends EntityRepository<Report> {
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("Report does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
|
@ -16,7 +16,6 @@ package org.openmetadata.catalog.jdbi3;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.openmetadata.catalog.Entity;
|
||||
import org.openmetadata.catalog.entity.teams.Role;
|
||||
@ -24,10 +23,8 @@ import org.openmetadata.catalog.exception.CatalogExceptionMessage;
|
||||
import org.openmetadata.catalog.resources.teams.RoleResource;
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
|
||||
public class RoleRepository extends EntityRepository<Role> {
|
||||
static final Fields ROLE_UPDATE_FIELDS = new Fields(RoleResource.FIELD_LIST, null);
|
||||
@ -41,7 +38,10 @@ public class RoleRepository extends EntityRepository<Role> {
|
||||
dao.roleDAO(),
|
||||
dao,
|
||||
ROLE_PATCH_FIELDS,
|
||||
ROLE_UPDATE_FIELDS);
|
||||
ROLE_UPDATE_FIELDS,
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -62,22 +62,21 @@ public class RoleRepository extends EntityRepository<Role> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(Role role) throws IOException {}
|
||||
public void prepare(Role role) throws IOException {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeEntity(Role role, boolean update) throws IOException {
|
||||
// Don't store href as JSON. Build it on the fly based on relationships
|
||||
role.withHref(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.roleDAO().update(role.getId(), JsonUtils.pojoToJson(role));
|
||||
} else {
|
||||
daoCollection.roleDAO().insert(role);
|
||||
}
|
||||
store(role.getId(), role, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeRelationships(Role role) {}
|
||||
public void storeRelationships(Role role) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityUpdater getUpdater(Role original, Role updated, boolean patchOperation) {
|
||||
@ -106,21 +105,11 @@ public class RoleRepository extends EntityRepository<Role> {
|
||||
return entity.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullyQualifiedName() {
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getVersion() {
|
||||
return entity.getVersion();
|
||||
@ -141,11 +130,6 @@ public class RoleRepository extends EntityRepository<Role> {
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("Role does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getEntityReference() {
|
||||
return new EntityReference()
|
||||
@ -162,11 +146,6 @@ public class RoleRepository extends EntityRepository<Role> {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
entity.setId(id);
|
||||
@ -194,9 +173,6 @@ public class RoleRepository extends EntityRepository<Role> {
|
||||
entity.setChangeDescription(changeDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(EntityReference owner) {}
|
||||
|
||||
@Override
|
||||
public void setDeleted(boolean flag) {
|
||||
entity.setDeleted(flag);
|
||||
@ -211,9 +187,6 @@ public class RoleRepository extends EntityRepository<Role> {
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {}
|
||||
}
|
||||
|
||||
/** Handles entity updated from PUT and POST operation. */
|
||||
|
@ -18,16 +18,13 @@ import static org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.openmetadata.catalog.Entity;
|
||||
import org.openmetadata.catalog.entity.services.StorageService;
|
||||
import org.openmetadata.catalog.resources.services.storage.StorageServiceResource;
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
|
||||
public class StorageServiceRepository extends EntityRepository<StorageService> {
|
||||
public StorageServiceRepository(CollectionDAO dao) {
|
||||
@ -38,7 +35,10 @@ public class StorageServiceRepository extends EntityRepository<StorageService> {
|
||||
dao.storageServiceDAO(),
|
||||
dao,
|
||||
Fields.EMPTY_FIELDS,
|
||||
Fields.EMPTY_FIELDS);
|
||||
Fields.EMPTY_FIELDS,
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,7 +47,9 @@ public class StorageServiceRepository extends EntityRepository<StorageService> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restorePatchAttributes(StorageService original, StorageService updated) {}
|
||||
public void restorePatchAttributes(StorageService original, StorageService updated) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityInterface<StorageService> getEntityInterface(StorageService entity) {
|
||||
@ -55,19 +57,19 @@ public class StorageServiceRepository extends EntityRepository<StorageService> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(StorageService entity) {}
|
||||
|
||||
@Override
|
||||
public void storeEntity(StorageService service, boolean update) throws IOException {
|
||||
if (update) {
|
||||
daoCollection.storageServiceDAO().update(service.getId(), JsonUtils.pojoToJson(service));
|
||||
} else {
|
||||
daoCollection.storageServiceDAO().insert(service);
|
||||
}
|
||||
public void prepare(StorageService entity) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeRelationships(StorageService entity) {}
|
||||
public void storeEntity(StorageService service, boolean update) throws IOException {
|
||||
store(service.getId(), service, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeRelationships(StorageService entity) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
public static class StorageServiceEntityInterface implements EntityInterface<StorageService> {
|
||||
private final StorageService entity;
|
||||
@ -91,21 +93,11 @@ public class StorageServiceRepository extends EntityRepository<StorageService> {
|
||||
return entity.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullyQualifiedName() {
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getVersion() {
|
||||
return entity.getVersion();
|
||||
@ -126,11 +118,6 @@ public class StorageServiceRepository extends EntityRepository<StorageService> {
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("Storage service does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
@ -151,11 +138,6 @@ public class StorageServiceRepository extends EntityRepository<StorageService> {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
entity.setId(id);
|
||||
@ -183,9 +165,6 @@ public class StorageServiceRepository extends EntityRepository<StorageService> {
|
||||
entity.setChangeDescription(changeDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(EntityReference owner) {}
|
||||
|
||||
@Override
|
||||
public void setDeleted(boolean flag) {
|
||||
entity.setDeleted(flag);
|
||||
@ -195,8 +174,5 @@ public class StorageServiceRepository extends EntityRepository<StorageService> {
|
||||
public StorageService withHref(URI href) {
|
||||
return entity.withHref(href);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {}
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,10 @@ public class TableRepository extends EntityRepository<Table> {
|
||||
dao.tableDAO(),
|
||||
dao,
|
||||
TABLE_PATCH_FIELDS,
|
||||
TABLE_UPDATE_FIELDS);
|
||||
TABLE_UPDATE_FIELDS,
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -362,11 +365,7 @@ public class TableRepository extends EntityRepository<Table> {
|
||||
table.setColumns(cloneWithoutTags(columnWithTags));
|
||||
table.getColumns().forEach(column -> column.setTags(null));
|
||||
|
||||
if (update) {
|
||||
daoCollection.tableDAO().update(table.getId(), JsonUtils.pojoToJson(table));
|
||||
} else {
|
||||
daoCollection.tableDAO().insert(table);
|
||||
}
|
||||
store(table.getId(), table, update);
|
||||
|
||||
// Restore the relationships
|
||||
table.withOwner(owner).withDatabase(database).withTags(tags).withColumns(columnWithTags).withService(service);
|
||||
@ -427,9 +426,10 @@ public class TableRepository extends EntityRepository<Table> {
|
||||
}
|
||||
}
|
||||
|
||||
private void applyTags(Table table) {
|
||||
@Override
|
||||
public void applyTags(Table table) {
|
||||
// Add table level tags by adding tag to table relationship
|
||||
EntityUtil.applyTags(daoCollection.tagDAO(), table.getTags(), table.getFullyQualifiedName());
|
||||
super.applyTags(table);
|
||||
applyTags(table.getColumns());
|
||||
}
|
||||
|
||||
@ -454,23 +454,6 @@ public class TableRepository extends EntityRepository<Table> {
|
||||
}
|
||||
}
|
||||
|
||||
private EntityReference getOwner(Table table) throws IOException {
|
||||
return table == null
|
||||
? null
|
||||
: EntityUtil.populateOwner(
|
||||
table.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO());
|
||||
}
|
||||
|
||||
private List<EntityReference> getFollowers(Table table) throws IOException {
|
||||
return table == null
|
||||
? null
|
||||
: EntityUtil.getFollowers(table.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO());
|
||||
}
|
||||
|
||||
private List<TagLabel> getTags(String fqn) {
|
||||
return daoCollection.tagDAO().getTags(fqn);
|
||||
}
|
||||
|
||||
private void getColumnTags(boolean setTags, List<Column> columns) {
|
||||
for (Column c : Optional.ofNullable(columns).orElse(Collections.emptyList())) {
|
||||
c.setTags(setTags ? getTags(c.getFullyQualifiedName()) : null);
|
||||
|
@ -31,11 +31,9 @@ import org.openmetadata.catalog.exception.CatalogExceptionMessage;
|
||||
import org.openmetadata.catalog.resources.teams.TeamResource;
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
|
||||
public class TeamRepository extends EntityRepository<Team> {
|
||||
static final Fields TEAM_UPDATE_FIELDS = new Fields(TeamResource.FIELD_LIST, "profile,users");
|
||||
@ -49,7 +47,10 @@ public class TeamRepository extends EntityRepository<Team> {
|
||||
dao.teamDAO(),
|
||||
dao,
|
||||
TEAM_PATCH_FIELDS,
|
||||
TEAM_UPDATE_FIELDS);
|
||||
TEAM_UPDATE_FIELDS,
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
public List<EntityReference> getUsers(List<UUID> userIds) {
|
||||
@ -106,11 +107,7 @@ public class TeamRepository extends EntityRepository<Team> {
|
||||
// Don't store users, href as JSON. Build it on the fly based on relationships
|
||||
team.withUsers(null).withHref(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.teamDAO().update(team.getId(), JsonUtils.pojoToJson(team));
|
||||
} else {
|
||||
daoCollection.teamDAO().insert(team);
|
||||
}
|
||||
store(team.getId(), team, update);
|
||||
|
||||
// Restore the relationships
|
||||
team.withUsers(users);
|
||||
@ -167,21 +164,11 @@ public class TeamRepository extends EntityRepository<Team> {
|
||||
return entity.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullyQualifiedName() {
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getVersion() {
|
||||
return entity.getVersion();
|
||||
@ -202,11 +189,6 @@ public class TeamRepository extends EntityRepository<Team> {
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("Team does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getEntityReference() {
|
||||
return new EntityReference()
|
||||
@ -223,11 +205,6 @@ public class TeamRepository extends EntityRepository<Team> {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
entity.setId(id);
|
||||
@ -255,9 +232,6 @@ public class TeamRepository extends EntityRepository<Team> {
|
||||
entity.setChangeDescription(changeDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(EntityReference owner) {}
|
||||
|
||||
@Override
|
||||
public void setDeleted(boolean flag) {
|
||||
entity.setDeleted(flag);
|
||||
@ -272,9 +246,6 @@ public class TeamRepository extends EntityRepository<Team> {
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {}
|
||||
}
|
||||
|
||||
/** Handles entity updated from PUT and POST operation. */
|
||||
|
@ -25,7 +25,6 @@ import org.openmetadata.catalog.Entity;
|
||||
import org.openmetadata.catalog.entity.data.Topic;
|
||||
import org.openmetadata.catalog.entity.services.MessagingService;
|
||||
import org.openmetadata.catalog.exception.CatalogExceptionMessage;
|
||||
import org.openmetadata.catalog.jdbi3.EntityRepository.EntityUpdater;
|
||||
import org.openmetadata.catalog.jdbi3.MessagingServiceRepository.MessagingServiceEntityInterface;
|
||||
import org.openmetadata.catalog.resources.topics.TopicResource;
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
@ -35,7 +34,6 @@ import org.openmetadata.catalog.type.topic.CleanupPolicy;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
|
||||
public class TopicRepository extends EntityRepository<Topic> {
|
||||
private static final Fields TOPIC_UPDATE_FIELDS = new Fields(TopicResource.FIELD_LIST, "owner,tags");
|
||||
@ -53,7 +51,10 @@ public class TopicRepository extends EntityRepository<Topic> {
|
||||
dao.topicDAO(),
|
||||
dao,
|
||||
TOPIC_PATCH_FIELDS,
|
||||
TOPIC_UPDATE_FIELDS);
|
||||
TOPIC_UPDATE_FIELDS,
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
@Transaction
|
||||
@ -81,11 +82,7 @@ public class TopicRepository extends EntityRepository<Topic> {
|
||||
// Don't store owner, database, href and tags as JSON. Build it on the fly based on relationships
|
||||
topic.withOwner(null).withService(null).withHref(null).withTags(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.topicDAO().update(topic.getId(), JsonUtils.pojoToJson(topic));
|
||||
} else {
|
||||
daoCollection.topicDAO().insert(topic);
|
||||
}
|
||||
store(topic.getId(), topic, update);
|
||||
|
||||
// Restore the relationships
|
||||
topic.withOwner(owner).withService(service).withTags(tags);
|
||||
@ -98,23 +95,6 @@ public class TopicRepository extends EntityRepository<Topic> {
|
||||
applyTags(topic);
|
||||
}
|
||||
|
||||
private void applyTags(Topic topic) {
|
||||
// Add topic level tags by adding tag to topic relationship
|
||||
EntityUtil.applyTags(daoCollection.tagDAO(), topic.getTags(), topic.getFullyQualifiedName());
|
||||
topic.setTags(getTags(topic.getFullyQualifiedName())); // Update tag to handle additional derived tags
|
||||
}
|
||||
|
||||
public EntityReference getOwner(Topic topic) throws IOException {
|
||||
return topic != null
|
||||
? EntityUtil.populateOwner(
|
||||
topic.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO(), daoCollection.teamDAO())
|
||||
: null;
|
||||
}
|
||||
|
||||
private void setOwner(Topic topic, EntityReference owner) {
|
||||
EntityUtil.setOwner(daoCollection.relationshipDAO(), topic.getId(), Entity.TOPIC, owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Topic setFields(Topic topic, Fields fields) throws IOException {
|
||||
topic.setService(getService(topic));
|
||||
@ -125,7 +105,9 @@ public class TopicRepository extends EntityRepository<Topic> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restorePatchAttributes(Topic original, Topic updated) {}
|
||||
public void restorePatchAttributes(Topic original, Topic updated) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRepository<Topic>.EntityUpdater getUpdater(Topic original, Topic updated, boolean patchOperation) {
|
||||
@ -137,16 +119,6 @@ public class TopicRepository extends EntityRepository<Topic> {
|
||||
return new TopicEntityInterface(entity);
|
||||
}
|
||||
|
||||
private List<EntityReference> getFollowers(Topic topic) throws IOException {
|
||||
return topic == null
|
||||
? null
|
||||
: EntityUtil.getFollowers(topic.getId(), daoCollection.relationshipDAO(), daoCollection.userDAO());
|
||||
}
|
||||
|
||||
private List<TagLabel> getTags(String fqn) {
|
||||
return daoCollection.tagDAO().getTags(fqn);
|
||||
}
|
||||
|
||||
private EntityReference getService(Topic topic) throws IOException {
|
||||
if (topic == null) {
|
||||
return null;
|
||||
|
@ -33,11 +33,9 @@ import org.openmetadata.catalog.exception.CatalogExceptionMessage;
|
||||
import org.openmetadata.catalog.resources.teams.UserResource;
|
||||
import org.openmetadata.catalog.type.ChangeDescription;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -54,7 +52,10 @@ public class UserRepository extends EntityRepository<User> {
|
||||
dao.userDAO(),
|
||||
dao,
|
||||
USER_PATCH_FIELDS,
|
||||
USER_UPDATE_FIELDS);
|
||||
USER_UPDATE_FIELDS,
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -74,11 +75,7 @@ public class UserRepository extends EntityRepository<User> {
|
||||
// Don't store roles, teams and href as JSON. Build it on the fly based on relationships
|
||||
user.withRoles(null).withTeams(null).withHref(null);
|
||||
|
||||
if (update) {
|
||||
daoCollection.userDAO().update(user.getId(), JsonUtils.pojoToJson(user));
|
||||
} else {
|
||||
daoCollection.userDAO().insert(user);
|
||||
}
|
||||
store(user.getId(), user, update);
|
||||
|
||||
// Restore the relationships
|
||||
user.withRoles(roles).withTeams(teams);
|
||||
@ -133,10 +130,6 @@ public class UserRepository extends EntityRepository<User> {
|
||||
daoCollection.relationshipDAO().findTo(user.getId().toString(), FOLLOWS.ordinal()));
|
||||
}
|
||||
|
||||
private User validateUser(UUID userId) throws IOException {
|
||||
return daoCollection.userDAO().findEntityById(userId);
|
||||
}
|
||||
|
||||
public List<EntityReference> validateRoles(List<UUID> roleIds) throws IOException {
|
||||
if (roleIds == null) {
|
||||
return Collections.emptyList(); // Return an empty roles list
|
||||
@ -221,21 +214,11 @@ public class UserRepository extends EntityRepository<User> {
|
||||
return entity.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullyQualifiedName() {
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getVersion() {
|
||||
return entity.getVersion();
|
||||
@ -256,11 +239,6 @@ public class UserRepository extends EntityRepository<User> {
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
throw new UnsupportedOperationException("User does not support followers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getEntityReference() {
|
||||
return new EntityReference()
|
||||
@ -277,11 +255,6 @@ public class UserRepository extends EntityRepository<User> {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(UUID id) {
|
||||
entity.setId(id);
|
||||
@ -309,9 +282,6 @@ public class UserRepository extends EntityRepository<User> {
|
||||
entity.setChangeDescription(changeDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(EntityReference owner) {}
|
||||
|
||||
@Override
|
||||
public void setDeleted(boolean flag) {
|
||||
entity.setDeleted(flag);
|
||||
@ -326,9 +296,6 @@ public class UserRepository extends EntityRepository<User> {
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {}
|
||||
}
|
||||
|
||||
/** Handles entity updated from PUT and POST operation. */
|
||||
|
@ -48,12 +48,10 @@ import org.openmetadata.catalog.type.ChangeEvent;
|
||||
import org.openmetadata.catalog.type.EntityReference;
|
||||
import org.openmetadata.catalog.type.EventType;
|
||||
import org.openmetadata.catalog.type.FailureDetails;
|
||||
import org.openmetadata.catalog.type.TagLabel;
|
||||
import org.openmetadata.catalog.type.Webhook;
|
||||
import org.openmetadata.catalog.type.Webhook.Status;
|
||||
import org.openmetadata.catalog.util.EntityInterface;
|
||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||
import org.openmetadata.catalog.util.JsonUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -69,7 +67,10 @@ public class WebhookRepository extends EntityRepository<Webhook> {
|
||||
dao.webhookDAO(),
|
||||
dao,
|
||||
Fields.EMPTY_FIELDS,
|
||||
Fields.EMPTY_FIELDS);
|
||||
Fields.EMPTY_FIELDS,
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -90,11 +91,7 @@ public class WebhookRepository extends EntityRepository<Webhook> {
|
||||
@Override
|
||||
public void storeEntity(Webhook entity, boolean update) throws IOException {
|
||||
entity.setHref(null);
|
||||
if (update) {
|
||||
daoCollection.webhookDAO().update(entity.getId(), JsonUtils.pojoToJson(entity));
|
||||
} else {
|
||||
daoCollection.webhookDAO().insert(entity);
|
||||
}
|
||||
store(entity.getId(), entity, update);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -191,21 +188,11 @@ public class WebhookRepository extends EntityRepository<Webhook> {
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullyQualifiedName() {
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getVersion() {
|
||||
return entity.getVersion();
|
||||
@ -236,21 +223,11 @@ public class WebhookRepository extends EntityRepository<Webhook> {
|
||||
return entity.getHref();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityReference> getFollowers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Webhook getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeDescription getChangeDescription() {
|
||||
return entity.getChangeDescription();
|
||||
@ -267,7 +244,9 @@ public class WebhookRepository extends EntityRepository<Webhook> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayName(String displayName) {}
|
||||
public void setDisplayName(String displayName) {
|
||||
/* No display name */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUpdateDetails(String updatedBy, Date updatedAt) {
|
||||
@ -281,9 +260,6 @@ public class WebhookRepository extends EntityRepository<Webhook> {
|
||||
entity.setChangeDescription(changeDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(EntityReference owner) {}
|
||||
|
||||
@Override
|
||||
public void setDeleted(boolean flag) {
|
||||
entity.setDeleted(flag);
|
||||
@ -293,9 +269,6 @@ public class WebhookRepository extends EntityRepository<Webhook> {
|
||||
public Webhook withHref(URI href) {
|
||||
return entity.withHref(href);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTags(List<TagLabel> tags) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,8 +52,6 @@ public class VersionResource {
|
||||
}
|
||||
}
|
||||
|
||||
public VersionResource() {}
|
||||
|
||||
@GET
|
||||
@Operation(
|
||||
summary = "Get version of metadata service",
|
||||
|
@ -22,7 +22,9 @@ public class NoopAuthorizer implements Authorizer {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(NoopAuthorizer.class);
|
||||
|
||||
@Override
|
||||
public void init(AuthorizerConfiguration config, Jdbi jdbi) {}
|
||||
public void init(AuthorizerConfiguration config, Jdbi jdbi) {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermissions(AuthenticationContext ctx, EntityReference entityOwnership) {
|
||||
|
@ -29,11 +29,15 @@ public interface EntityInterface<T> {
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
EntityReference getOwner();
|
||||
default EntityReference getOwner() {
|
||||
return null;
|
||||
}
|
||||
|
||||
String getFullyQualifiedName();
|
||||
|
||||
List<TagLabel> getTags();
|
||||
default List<TagLabel> getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
Double getVersion();
|
||||
|
||||
@ -43,7 +47,9 @@ public interface EntityInterface<T> {
|
||||
|
||||
URI getHref();
|
||||
|
||||
List<EntityReference> getFollowers();
|
||||
default List<EntityReference> getFollowers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
ChangeDescription getChangeDescription();
|
||||
|
||||
@ -51,13 +57,17 @@ public interface EntityInterface<T> {
|
||||
|
||||
T getEntity();
|
||||
|
||||
EntityReference getContainer();
|
||||
default EntityReference getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
void setId(UUID id);
|
||||
|
||||
void setDescription(String description);
|
||||
|
||||
void setTags(List<TagLabel> tags);
|
||||
default void setTags(List<TagLabel> tags) {
|
||||
return;
|
||||
};
|
||||
|
||||
void setDisplayName(String displayName);
|
||||
|
||||
@ -65,7 +75,9 @@ public interface EntityInterface<T> {
|
||||
|
||||
void setChangeDescription(Double newVersion, ChangeDescription changeDescription);
|
||||
|
||||
void setOwner(EntityReference owner);
|
||||
default void setOwner(EntityReference owner) {
|
||||
return;
|
||||
};
|
||||
|
||||
void setDeleted(boolean flag);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user