List Application References (#21008)

This commit is contained in:
Mohit Yadav 2025-04-29 11:31:07 +05:30 committed by GitHub
parent f068be820c
commit dabb0b725b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 45 additions and 0 deletions

View File

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

View File

@ -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> {

View File

@ -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(