mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-06 23:52:29 +00:00
Fixes #11617 Entity get operations check for ViewAll operation instead of specific view operations based on the field requested (#11904)
This commit is contained in:
parent
b0bfbad9da
commit
f23f67dfe9
@ -28,6 +28,7 @@ public class ResourceRegistry {
|
||||
MetadataOperation.CREATE,
|
||||
MetadataOperation.DELETE,
|
||||
MetadataOperation.VIEW_ALL,
|
||||
MetadataOperation.VIEW_BASIC,
|
||||
MetadataOperation.EDIT_ALL,
|
||||
MetadataOperation.EDIT_DESCRIPTION,
|
||||
MetadataOperation.EDIT_DISPLAY_NAME));
|
||||
|
@ -2,10 +2,15 @@ package org.openmetadata.service.resources;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.listOrEmpty;
|
||||
import static org.openmetadata.schema.type.MetadataOperation.CREATE;
|
||||
import static org.openmetadata.schema.type.MetadataOperation.VIEW_BASIC;
|
||||
import static org.openmetadata.service.util.EntityUtil.createOrUpdateOperation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
import javax.ws.rs.core.Response;
|
||||
@ -22,6 +27,7 @@ import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.schema.type.csv.CsvImportResult;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.OpenMetadataApplicationConfig;
|
||||
import org.openmetadata.service.exception.CatalogExceptionMessage;
|
||||
import org.openmetadata.service.jdbi3.EntityRepository;
|
||||
import org.openmetadata.service.jdbi3.ListFilter;
|
||||
import org.openmetadata.service.security.Authorizer;
|
||||
@ -44,6 +50,7 @@ public abstract class EntityResource<T extends EntityInterface, K extends Entity
|
||||
protected final List<String> allowedFields;
|
||||
@Getter protected final K repository;
|
||||
protected final Authorizer authorizer;
|
||||
protected final Map<String, MetadataOperation> fieldsToViewOperations = new HashMap<>();
|
||||
|
||||
protected EntityResource(Class<T> entityClass, K repository, Authorizer authorizer) {
|
||||
this.entityClass = entityClass;
|
||||
@ -51,6 +58,7 @@ public abstract class EntityResource<T extends EntityInterface, K extends Entity
|
||||
allowedFields = repository.getAllowedFields();
|
||||
this.repository = repository;
|
||||
this.authorizer = authorizer;
|
||||
addViewOperation("owner,followers,tags,extension", VIEW_BASIC);
|
||||
Entity.registerEntity(entityClass, entityType, repository, getEntitySpecificOperations());
|
||||
}
|
||||
|
||||
@ -305,9 +313,21 @@ public abstract class EntityResource<T extends EntityInterface, K extends Entity
|
||||
}
|
||||
|
||||
public static final MetadataOperation[] VIEW_ALL_OPERATIONS = {MetadataOperation.VIEW_ALL};
|
||||
public static final MetadataOperation[] VIEW_BASIC_OPERATIONS = {MetadataOperation.VIEW_BASIC};
|
||||
|
||||
protected MetadataOperation[] getViewOperations(Fields fields) {
|
||||
return VIEW_ALL_OPERATIONS;
|
||||
private MetadataOperation[] getViewOperations(Fields fields) {
|
||||
if (fields.getFieldList().isEmpty()) {
|
||||
return VIEW_BASIC_OPERATIONS;
|
||||
}
|
||||
Set<MetadataOperation> viewOperations = new TreeSet<>();
|
||||
for (String field : fields.getFieldList()) {
|
||||
MetadataOperation operation = fieldsToViewOperations.get(field);
|
||||
if (operation == null) {
|
||||
return VIEW_ALL_OPERATIONS;
|
||||
}
|
||||
viewOperations.add(operation);
|
||||
}
|
||||
return viewOperations.toArray(new MetadataOperation[0]);
|
||||
}
|
||||
|
||||
protected EntityReference getEntityReference(String entityType, String fqn) {
|
||||
@ -317,4 +337,16 @@ public abstract class EntityResource<T extends EntityInterface, K extends Entity
|
||||
protected List<EntityReference> getEntityReferences(String entityType, List<String> fqns) {
|
||||
return EntityUtil.getEntityReferences(entityType, fqns);
|
||||
}
|
||||
|
||||
protected void addViewOperation(String fieldsParam, MetadataOperation operation) {
|
||||
String[] fields = fieldsParam.replace(" ", "").split(",");
|
||||
for (String field : fields) {
|
||||
if (allowedFields.contains(field)) {
|
||||
fieldsToViewOperations.put(field, operation);
|
||||
} else if (!"owner,followers,tags,extension".contains(field)) {
|
||||
// Some common fields for all the entities might be missing. Ignore it.
|
||||
throw new IllegalArgumentException(CatalogExceptionMessage.invalidField(field));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,6 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Collection(name = "Workflow")
|
||||
public class WorkflowResource extends EntityResource<Workflow, WorkflowRepository> {
|
||||
|
||||
public static final String COLLECTION_PATH = "/v1/automations/workflows";
|
||||
static final String FIELDS = "owner";
|
||||
|
||||
|
@ -73,6 +73,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "charts")
|
||||
public class ChartResource extends EntityResource<Chart, ChartRepository> {
|
||||
public static final String COLLECTION_PATH = "v1/charts/";
|
||||
static final String FIELDS = "owner,followers,tags";
|
||||
|
||||
@Override
|
||||
public Chart addHref(UriInfo uriInfo, Chart chart) {
|
||||
@ -89,6 +90,7 @@ public class ChartResource extends EntityResource<Chart, ChartRepository> {
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE);
|
||||
return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_LINEAGE);
|
||||
}
|
||||
|
||||
@ -96,8 +98,6 @@ public class ChartResource extends EntityResource<Chart, ChartRepository> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "owner,followers,tags";
|
||||
|
||||
@GET
|
||||
@Operation(
|
||||
operationId = "listCharts",
|
||||
|
@ -73,7 +73,6 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "dashboards")
|
||||
public class DashboardResource extends EntityResource<Dashboard, DashboardRepository> {
|
||||
public static final String COLLECTION_PATH = "v1/dashboards/";
|
||||
|
||||
protected static final String FIELDS = "owner,charts,followers,tags,usageSummary,extension,dataModels";
|
||||
|
||||
@Override
|
||||
@ -92,6 +91,8 @@ public class DashboardResource extends EntityResource<Dashboard, DashboardReposi
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("charts,dataModels", MetadataOperation.VIEW_BASIC);
|
||||
addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE);
|
||||
return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_LINEAGE);
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
package org.openmetadata.service.resources.databases;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.listOf;
|
||||
|
||||
import io.swagger.v3.oas.annotations.ExternalDocumentation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -23,6 +25,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
import javax.validation.Valid;
|
||||
@ -49,6 +52,7 @@ import org.openmetadata.schema.api.data.RestoreEntity;
|
||||
import org.openmetadata.schema.entity.data.Database;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.DatabaseRepository;
|
||||
@ -67,6 +71,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "databases")
|
||||
public class DatabaseResource extends EntityResource<Database, DatabaseRepository> {
|
||||
public static final String COLLECTION_PATH = "v1/databases/";
|
||||
static final String FIELDS = "owner,databaseSchemas,usageSummary,location,tags,extension";
|
||||
|
||||
@Override
|
||||
public Database addHref(UriInfo uriInfo, Database db) {
|
||||
@ -77,6 +82,13 @@ public class DatabaseResource extends EntityResource<Database, DatabaseRepositor
|
||||
return db;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("databaseSchemas,location", MetadataOperation.VIEW_BASIC);
|
||||
addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE);
|
||||
return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE);
|
||||
}
|
||||
|
||||
public DatabaseResource(CollectionDAO dao, Authorizer authorizer) {
|
||||
super(Database.class, new DatabaseRepository(dao), authorizer);
|
||||
}
|
||||
@ -85,8 +97,6 @@ public class DatabaseResource extends EntityResource<Database, DatabaseRepositor
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "owner,databaseSchemas,usageSummary,location,tags,extension";
|
||||
|
||||
@GET
|
||||
@Operation(
|
||||
operationId = "listDatabases",
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
package org.openmetadata.service.resources.databases;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.listOf;
|
||||
|
||||
import io.swagger.v3.oas.annotations.ExternalDocumentation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -23,6 +25,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
import javax.validation.Valid;
|
||||
@ -49,6 +52,7 @@ import org.openmetadata.schema.api.data.RestoreEntity;
|
||||
import org.openmetadata.schema.entity.data.DatabaseSchema;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.DatabaseSchemaRepository;
|
||||
@ -67,6 +71,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "databaseSchemas")
|
||||
public class DatabaseSchemaResource extends EntityResource<DatabaseSchema, DatabaseSchemaRepository> {
|
||||
public static final String COLLECTION_PATH = "v1/databaseSchemas/";
|
||||
static final String FIELDS = "owner,tables,usageSummary,tags,extension";
|
||||
|
||||
@Override
|
||||
public DatabaseSchema addHref(UriInfo uriInfo, DatabaseSchema schema) {
|
||||
@ -81,12 +86,17 @@ public class DatabaseSchemaResource extends EntityResource<DatabaseSchema, Datab
|
||||
super(DatabaseSchema.class, new DatabaseSchemaRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("tables", MetadataOperation.VIEW_BASIC);
|
||||
addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE);
|
||||
return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE);
|
||||
}
|
||||
|
||||
public static class DatabaseSchemaList extends ResultList<DatabaseSchema> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "owner,tables,usageSummary,tags,extension";
|
||||
|
||||
@GET
|
||||
@Operation(
|
||||
operationId = "listDBSchemas",
|
||||
|
@ -96,13 +96,17 @@ public class TableResource extends EntityResource<Table, TableRepository> {
|
||||
|
||||
public TableResource(CollectionDAO dao, Authorizer authorizer) {
|
||||
super(Table.class, new TableRepository(dao), authorizer);
|
||||
allowedFields.add("customMetrics");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
allowedFields.add("customMetrics");
|
||||
addViewOperation(
|
||||
"columns,tableConstraints,tablePartition,joins,viewDefinition,dataModel", MetadataOperation.VIEW_BASIC);
|
||||
addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE);
|
||||
addViewOperation("customMetrics", MetadataOperation.VIEW_TESTS);
|
||||
addViewOperation("testSuite", MetadataOperation.VIEW_TESTS);
|
||||
return listOf(
|
||||
MetadataOperation.VIEW_BASIC,
|
||||
MetadataOperation.VIEW_TESTS,
|
||||
MetadataOperation.VIEW_QUERIES,
|
||||
MetadataOperation.VIEW_DATA_PROFILE,
|
||||
|
@ -13,8 +13,6 @@
|
||||
|
||||
package org.openmetadata.service.resources.datamodels;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.listOf;
|
||||
|
||||
import io.swagger.v3.oas.annotations.ExternalDocumentation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -25,7 +23,6 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
import javax.validation.Valid;
|
||||
@ -52,7 +49,6 @@ import org.openmetadata.schema.api.data.RestoreEntity;
|
||||
import org.openmetadata.schema.entity.data.DashboardDataModel;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.DashboardDataModelRepository;
|
||||
@ -89,11 +85,6 @@ public class DashboardDataModelResource extends EntityResource<DashboardDataMode
|
||||
super(DashboardDataModel.class, new DashboardDataModelRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_LINEAGE);
|
||||
}
|
||||
|
||||
public static class DashboardDataModelList extends ResultList<DashboardDataModel> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
@ -89,6 +89,12 @@ public class TestCaseResource extends EntityResource<TestCase, TestCaseRepositor
|
||||
super(TestCase.class, new TestCaseRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("testSuite,testDefinition", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class TestCaseList extends ResultList<TestCase> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
import javax.validation.Valid;
|
||||
@ -39,6 +40,7 @@ import org.openmetadata.schema.tests.TestSuite;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.EntityReference;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.ListFilter;
|
||||
@ -57,7 +59,6 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "TestSuites")
|
||||
public class TestSuiteResource extends EntityResource<TestSuite, TestSuiteRepository> {
|
||||
public static final String COLLECTION_PATH = "/v1/dataQuality/testSuites";
|
||||
|
||||
static final String FIELDS = "owner,tests";
|
||||
|
||||
@Override
|
||||
@ -71,6 +72,12 @@ public class TestSuiteResource extends EntityResource<TestSuite, TestSuiteReposi
|
||||
super(TestSuite.class, new TestSuiteRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("tests", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class TestSuiteList extends ResultList<TestSuite> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ import org.openmetadata.schema.entity.events.SubscriptionStatus;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.Function;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.schema.type.SubscriptionResourceDescriptor;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.OpenMetadataApplicationConfig;
|
||||
@ -104,6 +105,12 @@ public class EventSubscriptionResource extends EntityResource<EventSubscription,
|
||||
this.daoCollection = dao;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("filteringRules", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class EventSubscriptionList extends ResultList<EventSubscription> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
import javax.validation.Valid;
|
||||
@ -49,6 +50,7 @@ import org.openmetadata.schema.api.data.RestoreEntity;
|
||||
import org.openmetadata.schema.entity.data.Glossary;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.schema.type.csv.CsvImportResult;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
@ -70,6 +72,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "glossaries", order = 6) // Initialize before GlossaryTerm and after Classification and Tags
|
||||
public class GlossaryResource extends EntityResource<Glossary, GlossaryRepository> {
|
||||
public static final String COLLECTION_PATH = "v1/glossaries/";
|
||||
static final String FIELDS = "owner,tags,reviewers,usageCount,termCount";
|
||||
|
||||
@Override
|
||||
public Glossary addHref(UriInfo uriInfo, Glossary glossary) {
|
||||
@ -83,12 +86,16 @@ public class GlossaryResource extends EntityResource<Glossary, GlossaryRepositor
|
||||
super(Glossary.class, new GlossaryRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("reviewers,usageCount,termCount", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class GlossaryList extends ResultList<Glossary> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "owner,tags,reviewers,usageCount,termCount";
|
||||
|
||||
@GET
|
||||
@Valid
|
||||
@Operation(
|
||||
|
@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
import javax.validation.Valid;
|
||||
@ -51,6 +52,7 @@ import org.openmetadata.schema.entity.data.GlossaryTerm;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.EntityReference;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.OpenMetadataApplicationConfig;
|
||||
import org.openmetadata.service.exception.CatalogExceptionMessage;
|
||||
@ -72,6 +74,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "glossaryTerms", order = 7) // Initialized after Glossary, Classification, and Tags
|
||||
public class GlossaryTermResource extends EntityResource<GlossaryTerm, GlossaryTermRepository> {
|
||||
public static final String COLLECTION_PATH = "v1/glossaryTerms/";
|
||||
static final String FIELDS = "children,relatedTerms,reviewers,owner,tags,usageCount";
|
||||
|
||||
@Override
|
||||
public GlossaryTerm addHref(UriInfo uriInfo, GlossaryTerm term) {
|
||||
@ -94,12 +97,16 @@ public class GlossaryTermResource extends EntityResource<GlossaryTerm, GlossaryT
|
||||
super(GlossaryTerm.class, new GlossaryTermRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("children,relatedTerms,reviewers,usageCount", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class GlossaryTermList extends ResultList<GlossaryTerm> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "children,relatedTerms,reviewers,owner,tags,usageCount";
|
||||
|
||||
@GET
|
||||
@Valid
|
||||
@Operation(
|
||||
|
@ -11,6 +11,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
import javax.validation.Valid;
|
||||
@ -40,6 +41,7 @@ import org.openmetadata.schema.dataInsight.kpi.Kpi;
|
||||
import org.openmetadata.schema.dataInsight.type.KpiResult;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.exception.EntityNotFoundException;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
@ -60,7 +62,6 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "kpi")
|
||||
public class KpiResource extends EntityResource<Kpi, KpiRepository> {
|
||||
public static final String COLLECTION_PATH = "/v1/kpi";
|
||||
|
||||
static final String FIELDS = "owner,dataInsightChart,kpiResult";
|
||||
|
||||
@Override
|
||||
@ -75,6 +76,12 @@ public class KpiResource extends EntityResource<Kpi, KpiRepository> {
|
||||
super(Kpi.class, new KpiRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("dataInsightChart,kpiResult", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class KpiList extends ResultList<Kpi> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
package org.openmetadata.service.resources.metrics;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.listOf;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@ -20,6 +22,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Max;
|
||||
@ -40,6 +43,7 @@ import javax.ws.rs.core.SecurityContext;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import org.openmetadata.schema.entity.data.Metrics;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.ListFilter;
|
||||
import org.openmetadata.service.jdbi3.MetricsRepository;
|
||||
@ -59,11 +63,18 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "metrics")
|
||||
public class MetricsResource extends EntityResource<Metrics, MetricsRepository> {
|
||||
public static final String COLLECTION_PATH = "/v1/metrics/";
|
||||
static final String FIELDS = "owner,usageSummary";
|
||||
|
||||
public MetricsResource(CollectionDAO dao, Authorizer authorizer) {
|
||||
super(Metrics.class, new MetricsRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE);
|
||||
return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Metrics addHref(UriInfo uriInfo, Metrics entity) {
|
||||
return entity;
|
||||
@ -73,8 +84,6 @@ public class MetricsResource extends EntityResource<Metrics, MetricsRepository>
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "owner,usageSummary";
|
||||
|
||||
@GET
|
||||
@Operation(
|
||||
operationId = "listMetrics",
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
package org.openmetadata.service.resources.mlmodels;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.listOf;
|
||||
|
||||
import io.swagger.v3.oas.annotations.ExternalDocumentation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -23,6 +25,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
import javax.validation.Valid;
|
||||
@ -50,6 +53,7 @@ import org.openmetadata.schema.entity.data.MlModel;
|
||||
import org.openmetadata.schema.type.ChangeEvent;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.ListFilter;
|
||||
@ -69,6 +73,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "mlmodels")
|
||||
public class MlModelResource extends EntityResource<MlModel, MlModelRepository> {
|
||||
public static final String COLLECTION_PATH = "v1/mlmodels/";
|
||||
static final String FIELDS = "owner,dashboard,followers,tags,usageSummary,extension";
|
||||
|
||||
@Override
|
||||
public MlModel addHref(UriInfo uriInfo, MlModel mlmodel) {
|
||||
@ -84,12 +89,17 @@ public class MlModelResource extends EntityResource<MlModel, MlModelRepository>
|
||||
super(MlModel.class, new MlModelRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("dashboard", MetadataOperation.VIEW_BASIC);
|
||||
addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE);
|
||||
return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE);
|
||||
}
|
||||
|
||||
public static class MlModelList extends ResultList<MlModel> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "owner,dashboard,followers,tags,usageSummary,extension";
|
||||
|
||||
@GET
|
||||
@Valid
|
||||
@Operation(
|
||||
|
@ -78,6 +78,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "pipelines")
|
||||
public class PipelineResource extends EntityResource<Pipeline, PipelineRepository> {
|
||||
public static final String COLLECTION_PATH = "v1/pipelines/";
|
||||
static final String FIELDS = "owner,tasks,pipelineStatus,followers,tags,extension";
|
||||
|
||||
@Override
|
||||
public Pipeline addHref(UriInfo uriInfo, Pipeline pipeline) {
|
||||
@ -94,6 +95,7 @@ public class PipelineResource extends EntityResource<Pipeline, PipelineRepositor
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("tasks,pipelineStatus", MetadataOperation.VIEW_BASIC);
|
||||
return listOf(MetadataOperation.EDIT_LINEAGE, MetadataOperation.EDIT_STATUS);
|
||||
}
|
||||
|
||||
@ -105,8 +107,6 @@ public class PipelineResource extends EntityResource<Pipeline, PipelineRepositor
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "owner,tasks,pipelineStatus,followers,tags,extension";
|
||||
|
||||
@GET
|
||||
@Valid
|
||||
@Operation(
|
||||
|
@ -82,6 +82,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "policies", order = 0)
|
||||
public class PolicyResource extends EntityResource<Policy, PolicyRepository> {
|
||||
public static final String COLLECTION_PATH = "v1/policies/";
|
||||
public static final String FIELDS = "owner,location,teams,roles";
|
||||
|
||||
@Override
|
||||
public Policy addHref(UriInfo uriInfo, Policy policy) {
|
||||
@ -95,6 +96,12 @@ public class PolicyResource extends EntityResource<Policy, PolicyRepository> {
|
||||
super(Policy.class, new PolicyRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("location,teams,roles", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(OpenMetadataApplicationConfig config) throws IOException {
|
||||
// Load any existing rules from database, before loading seed data.
|
||||
@ -126,8 +133,6 @@ public class PolicyResource extends EntityResource<Policy, PolicyRepository> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
public static final String FIELDS = "owner,location,teams,roles";
|
||||
|
||||
@GET
|
||||
@Valid
|
||||
@Operation(
|
||||
|
@ -64,13 +64,19 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Collection(name = "queries")
|
||||
public class QueryResource extends EntityResource<Query, QueryRepository> {
|
||||
|
||||
public static final String COLLECTION_PATH = "v1/queries/";
|
||||
static final String FIELDS = "owner,followers,users,votes,tags,queryUsedIn";
|
||||
|
||||
public QueryResource(CollectionDAO dao, Authorizer authorizer) {
|
||||
super(Query.class, new QueryRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("users,votes,queryUsedIn", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query addHref(UriInfo uriInfo, Query entity) {
|
||||
Entity.withHref(uriInfo, entity.getOwner());
|
||||
@ -84,8 +90,6 @@ public class QueryResource extends EntityResource<Query, QueryRepository> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "owner,followers,users,votes,tags,queryUsedIn";
|
||||
|
||||
@GET
|
||||
@Operation(
|
||||
operationId = "listQueries",
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
package org.openmetadata.service.resources.reports;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.listOf;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@ -20,6 +22,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.validation.Valid;
|
||||
import javax.ws.rs.Consumes;
|
||||
@ -38,6 +41,7 @@ import javax.ws.rs.core.SecurityContext;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import org.openmetadata.schema.entity.data.Report;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.ListFilter;
|
||||
import org.openmetadata.service.jdbi3.ReportRepository;
|
||||
@ -58,11 +62,18 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "reports")
|
||||
public class ReportResource extends EntityResource<Report, ReportRepository> {
|
||||
public static final String COLLECTION_PATH = "/v1/reports/";
|
||||
static final String FIELDS = "owner,usageSummary";
|
||||
|
||||
public ReportResource(CollectionDAO dao, Authorizer authorizer) {
|
||||
super(Report.class, new ReportRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("usageSummary", MetadataOperation.VIEW_USAGE);
|
||||
return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Report addHref(UriInfo uriInfo, Report entity) {
|
||||
return entity;
|
||||
@ -72,8 +83,6 @@ public class ReportResource extends EntityResource<Report, ReportRepository> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "owner,usageSummary";
|
||||
|
||||
@GET
|
||||
@Operation(
|
||||
operationId = "listReports",
|
||||
|
@ -92,6 +92,12 @@ public class DatabaseServiceResource
|
||||
return service;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("pipelines", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
public DatabaseServiceResource(CollectionDAO dao, Authorizer authorizer) {
|
||||
super(DatabaseService.class, new DatabaseServiceRepository(dao), authorizer, ServiceType.DATABASE);
|
||||
}
|
||||
|
@ -106,6 +106,7 @@ public class IngestionPipelineResource extends EntityResource<IngestionPipeline,
|
||||
private PipelineServiceClient pipelineServiceClient;
|
||||
private OpenMetadataApplicationConfig openMetadataApplicationConfig;
|
||||
private final MetadataServiceRepository metadataServiceRepository;
|
||||
static final String FIELDS = FIELD_OWNER;
|
||||
|
||||
@Override
|
||||
public IngestionPipeline addHref(UriInfo uriInfo, IngestionPipeline ingestionPipeline) {
|
||||
@ -179,8 +180,6 @@ public class IngestionPipelineResource extends EntityResource<IngestionPipeline,
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = FIELD_OWNER;
|
||||
|
||||
@GET
|
||||
@Valid
|
||||
@Operation(
|
||||
|
@ -78,7 +78,6 @@ import org.openmetadata.service.util.ResultList;
|
||||
public class MessagingServiceResource
|
||||
extends ServiceEntityResource<MessagingService, MessagingServiceRepository, MessagingConnection> {
|
||||
public static final String COLLECTION_PATH = "v1/services/messagingServices/";
|
||||
|
||||
public static final String FIELDS = FIELD_OWNER;
|
||||
|
||||
@Override
|
||||
|
@ -129,6 +129,12 @@ public class MetadataServiceResource
|
||||
super(MetadataService.class, new MetadataServiceRepository(dao), authorizer, ServiceType.METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("pipelines", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class MetadataServiceList extends ResultList<MetadataService> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
package org.openmetadata.service.resources.services.mlmodel;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.listOf;
|
||||
|
||||
import io.swagger.v3.oas.annotations.ExternalDocumentation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -76,7 +78,6 @@ import org.openmetadata.service.util.ResultList;
|
||||
public class MlModelServiceResource
|
||||
extends ServiceEntityResource<MlModelService, MlModelServiceRepository, MlModelConnection> {
|
||||
public static final String COLLECTION_PATH = "v1/services/mlmodelServices/";
|
||||
|
||||
public static final String FIELDS = "pipelines,owner,tags";
|
||||
|
||||
@Override
|
||||
@ -91,6 +92,12 @@ public class MlModelServiceResource
|
||||
super(MlModelService.class, new MlModelServiceRepository(dao), authorizer, ServiceType.ML_MODEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("pipelines", MetadataOperation.VIEW_BASIC);
|
||||
return listOf(MetadataOperation.VIEW_USAGE, MetadataOperation.EDIT_USAGE);
|
||||
}
|
||||
|
||||
public static class MlModelServiceList extends ResultList<MlModelService> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
@ -90,6 +90,12 @@ public class PipelineServiceResource
|
||||
super(PipelineService.class, new PipelineServiceRepository(dao), authorizer, ServiceType.PIPELINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("pipelines", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class PipelineServiceList extends ResultList<PipelineService> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
@ -67,7 +67,6 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "storageServices")
|
||||
public class StorageServiceResource
|
||||
extends ServiceEntityResource<StorageService, StorageServiceRepository, StorageConnection> {
|
||||
|
||||
public static final String COLLECTION_PATH = "v1/services/storageServices/";
|
||||
static final String FIELDS = "pipelines,owner,tags";
|
||||
|
||||
@ -83,6 +82,12 @@ public class StorageServiceResource
|
||||
super(StorageService.class, new StorageServiceRepository(dao), authorizer, ServiceType.STORAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("pipelines", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class StorageServiceList extends ResultList<StorageService> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
import javax.validation.Valid;
|
||||
@ -37,6 +38,7 @@ import org.openmetadata.schema.entity.data.Container;
|
||||
import org.openmetadata.schema.type.ChangeEvent;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.ContainerRepository;
|
||||
@ -59,6 +61,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "containers")
|
||||
public class ContainerResource extends EntityResource<Container, ContainerRepository> {
|
||||
public static final String COLLECTION_PATH = "v1/containers/";
|
||||
static final String FIELDS = "parent,children,dataModel,owner,tags,followers,extension";
|
||||
|
||||
@Override
|
||||
public Container addHref(UriInfo uriInfo, Container container) {
|
||||
@ -75,15 +78,16 @@ public class ContainerResource extends EntityResource<Container, ContainerReposi
|
||||
super(Container.class, new ContainerRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("parent,children,dataModel", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class ContainerList extends ResultList<Container> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
/* List of fields that are not stored as a property in the json document.
|
||||
These are typically relationships or properties that could have a lot of data.
|
||||
*/
|
||||
static final String FIELDS = "parent,children,dataModel,owner,tags,followers,extension";
|
||||
|
||||
@GET
|
||||
@Valid
|
||||
@Operation(
|
||||
|
@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
@ -52,6 +53,7 @@ import org.openmetadata.schema.entity.classification.Classification;
|
||||
import org.openmetadata.schema.entity.data.Table;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.jdbi3.ClassificationRepository;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.ListFilter;
|
||||
@ -75,6 +77,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "classifications", order = 4) // Initialize before TagResource, Glossary, and GlossaryTerms
|
||||
public class ClassificationResource extends EntityResource<Classification, ClassificationRepository> {
|
||||
public static final String TAG_COLLECTION_PATH = "/v1/classifications/";
|
||||
static final String FIELDS = "usageCount,termCount";
|
||||
|
||||
static class ClassificationList extends ResultList<Classification> {
|
||||
/* Required for serde */
|
||||
@ -85,8 +88,11 @@ public class ClassificationResource extends EntityResource<Classification, Class
|
||||
Objects.requireNonNull(collectionDAO, "TagRepository must not be null");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") // Method used by reflection
|
||||
static final String FIELDS = "usageCount,termCount";
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("usageCount,termCount", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Operation(
|
||||
|
@ -59,6 +59,7 @@ import org.openmetadata.schema.entity.classification.Tag;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.EntityReference;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.schema.type.Relationship;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.OpenMetadataApplicationConfig;
|
||||
@ -92,6 +93,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
public class TagResource extends EntityResource<Tag, TagRepository> {
|
||||
private final CollectionDAO daoCollection;
|
||||
public static final String TAG_COLLECTION_PATH = "/v1/tags/";
|
||||
static final String FIELDS = "children, usageCount";
|
||||
|
||||
static class TagList extends ResultList<Tag> {
|
||||
/* Required for serde */
|
||||
@ -103,6 +105,12 @@ public class TagResource extends EntityResource<Tag, TagRepository> {
|
||||
daoCollection = collectionDAO;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("children,usageCount", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
private void migrateTags() {
|
||||
// Just want to run it when upgrading to version above 0.13.1 where tag relationship are not there , once we have
|
||||
// any entries we don't need to run it
|
||||
@ -188,8 +196,6 @@ public class TagResource extends EntityResource<Tag, TagRepository> {
|
||||
}
|
||||
}
|
||||
|
||||
static final String FIELDS = "children, usageCount";
|
||||
|
||||
@GET
|
||||
@Valid
|
||||
@Operation(
|
||||
|
@ -54,6 +54,7 @@ import org.openmetadata.schema.entity.teams.Role;
|
||||
import org.openmetadata.schema.type.EntityHistory;
|
||||
import org.openmetadata.schema.type.EntityReference;
|
||||
import org.openmetadata.schema.type.Include;
|
||||
import org.openmetadata.schema.type.MetadataOperation;
|
||||
import org.openmetadata.service.Entity;
|
||||
import org.openmetadata.service.OpenMetadataApplicationConfig;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
@ -79,6 +80,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Slf4j
|
||||
public class RoleResource extends EntityResource<Role, RoleRepository> {
|
||||
public static final String COLLECTION_PATH = "/v1/roles/";
|
||||
public static final String FIELDS = "policies,teams,users";
|
||||
|
||||
@Override
|
||||
public Role addHref(UriInfo uriInfo, Role role) {
|
||||
@ -92,6 +94,12 @@ public class RoleResource extends EntityResource<Role, RoleRepository> {
|
||||
super(Role.class, new RoleRepository(collectionDAO), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("policies,teams,users", MetadataOperation.VIEW_BASIC);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(OpenMetadataApplicationConfig config) throws IOException {
|
||||
List<Role> roles = repository.getEntitiesFromSeedData();
|
||||
@ -111,8 +119,6 @@ public class RoleResource extends EntityResource<Role, RoleRepository> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
public static final String FIELDS = "policies,teams,users";
|
||||
|
||||
@GET
|
||||
@Valid
|
||||
@Operation(
|
||||
|
@ -103,6 +103,8 @@ public class TeamResource extends EntityResource<Team, TeamRepository> {
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation(
|
||||
"profile,owns,defaultRoles,parents,children,policies,userCount,childrenCount", MetadataOperation.VIEW_BASIC);
|
||||
return listOf(MetadataOperation.EDIT_POLICY, MetadataOperation.EDIT_USERS);
|
||||
}
|
||||
|
||||
|
@ -158,6 +158,7 @@ public class UserResource extends EntityResource<User, UserRepository> {
|
||||
private boolean isEmailServiceEnabled;
|
||||
private AuthenticationConfiguration authenticationConfiguration;
|
||||
private final AuthenticatorHandler authHandler;
|
||||
static final String FIELDS = "profile,roles,teams,follows,owns";
|
||||
|
||||
@Override
|
||||
public User addHref(UriInfo uriInfo, User user) {
|
||||
@ -180,6 +181,7 @@ public class UserResource extends EntityResource<User, UserRepository> {
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("profile,roles,teams,follows,owns", MetadataOperation.VIEW_BASIC);
|
||||
return listOf(MetadataOperation.EDIT_TEAMS);
|
||||
}
|
||||
|
||||
@ -201,8 +203,6 @@ public class UserResource extends EntityResource<User, UserRepository> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "profile,roles,teams,follows,owns";
|
||||
|
||||
@GET
|
||||
@Valid
|
||||
@Operation(
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
package org.openmetadata.service.resources.topics;
|
||||
|
||||
import static org.openmetadata.common.utils.CommonUtil.listOf;
|
||||
|
||||
import io.swagger.v3.oas.annotations.ExternalDocumentation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -23,6 +25,7 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.json.JsonPatch;
|
||||
import javax.validation.Valid;
|
||||
@ -73,6 +76,7 @@ import org.openmetadata.service.util.ResultList;
|
||||
@Collection(name = "topics")
|
||||
public class TopicResource extends EntityResource<Topic, TopicRepository> {
|
||||
public static final String COLLECTION_PATH = "v1/topics/";
|
||||
static final String FIELDS = "owner,followers,tags,sampleData,extension";
|
||||
|
||||
@Override
|
||||
public Topic addHref(UriInfo uriInfo, Topic topic) {
|
||||
@ -86,12 +90,16 @@ public class TopicResource extends EntityResource<Topic, TopicRepository> {
|
||||
super(Topic.class, new TopicRepository(dao), authorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<MetadataOperation> getEntitySpecificOperations() {
|
||||
addViewOperation("sampleData", MetadataOperation.VIEW_SAMPLE_DATA);
|
||||
return listOf(MetadataOperation.VIEW_SAMPLE_DATA, MetadataOperation.EDIT_SAMPLE_DATA);
|
||||
}
|
||||
|
||||
public static class TopicList extends ResultList<Topic> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
static final String FIELDS = "owner,followers,tags,sampleData,extension";
|
||||
|
||||
@GET
|
||||
@Operation(
|
||||
operationId = "listTopics",
|
||||
|
@ -126,7 +126,7 @@
|
||||
"$ref": "../services/dashboardService.json#/definitions/dashboardServiceType"
|
||||
},
|
||||
"usageSummary": {
|
||||
"description": "Latest usage information for this database.",
|
||||
"description": "Latest usage information for this chart.",
|
||||
"$ref": "../../type/usageDetails.json",
|
||||
"default": null
|
||||
},
|
||||
|
@ -83,7 +83,7 @@
|
||||
"$ref": "../services/dashboardService.json#/definitions/dashboardServiceType"
|
||||
},
|
||||
"usageSummary": {
|
||||
"description": "Latest usage information for this database.",
|
||||
"description": "Latest usage information for this dashboard.",
|
||||
"$ref": "../../type/usageDetails.json",
|
||||
"default": null
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user