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