mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-13 00:22:23 +00:00
List Application References (#21008)
This commit is contained in:
parent
f068be820c
commit
dabb0b725b
@ -140,6 +140,10 @@ public class AppRepository extends EntityRepository<App> {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<EntityReference> listAllAppsReference() {
|
||||
return daoCollection.applicationDAO().listAppsRef();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeEntity(App entity, boolean update) {
|
||||
List<EntityReference> ownerRefs = entity.getOwners();
|
||||
|
||||
@ -16,6 +16,7 @@ package org.openmetadata.service.jdbi3;
|
||||
import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty;
|
||||
import static org.openmetadata.schema.type.Relationship.CONTAINS;
|
||||
import static org.openmetadata.schema.type.Relationship.MENTIONED_IN;
|
||||
import static org.openmetadata.service.Entity.APPLICATION;
|
||||
import static org.openmetadata.service.Entity.GLOSSARY_TERM;
|
||||
import static org.openmetadata.service.Entity.ORGANIZATION_NAME;
|
||||
import static org.openmetadata.service.Entity.QUERY;
|
||||
@ -2583,6 +2584,22 @@ public interface CollectionDAO {
|
||||
default Class<App> getEntityClass() {
|
||||
return App.class;
|
||||
}
|
||||
|
||||
@SqlQuery("SELECT id, name from installed_apps")
|
||||
@RegisterRowMapper(AppEntityReferenceMapper.class)
|
||||
List<EntityReference> listAppsRef();
|
||||
|
||||
class AppEntityReferenceMapper implements RowMapper<EntityReference> {
|
||||
@Override
|
||||
public EntityReference map(ResultSet rs, StatementContext ctx) throws SQLException {
|
||||
String fqn = rs.getString("name");
|
||||
return new EntityReference()
|
||||
.withId(UUID.fromString(rs.getString("id")))
|
||||
.withName(fqn)
|
||||
.withFullyQualifiedName(fqn)
|
||||
.withType(APPLICATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface ApplicationMarketPlaceDAO extends EntityDAO<AppMarketPlaceDefinition> {
|
||||
|
||||
@ -170,6 +170,10 @@ public class AppResource extends EntityResource<App, AppRepository> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
public static class AppRefList extends ResultList<EntityReference> {
|
||||
/* Required for serde */
|
||||
}
|
||||
|
||||
public static class AppRunList extends ResultList<AppRunRecord> {
|
||||
/* Required for serde */
|
||||
}
|
||||
@ -239,6 +243,26 @@ public class AppResource extends EntityResource<App, AppRepository> {
|
||||
uriInfo, securityContext, fieldsParam, filter, limitParam, before, after);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/installed")
|
||||
@Operation(
|
||||
operationId = "listInstalledAppsInformation",
|
||||
summary = "List Entity Reference for installed application",
|
||||
description = "Get a list of applications ",
|
||||
responses = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "List of Installed Applications Entity Reference",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = AppRefList.class)))
|
||||
})
|
||||
public List<EntityReference> list(
|
||||
@Context UriInfo uriInfo, @Context SecurityContext securityContext) {
|
||||
return repository.listAllAppsReference();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/name/{name}/status")
|
||||
@Operation(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user