mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-29 16:39:04 +00:00
Get Or Null App
This commit is contained in:
parent
3740a7b346
commit
9733ea2f01
@ -69,6 +69,7 @@ import org.openmetadata.service.OpenMetadataApplicationConfig;
|
||||
import org.openmetadata.service.apps.ApplicationHandler;
|
||||
import org.openmetadata.service.apps.scheduler.AppScheduler;
|
||||
import org.openmetadata.service.clients.pipeline.PipelineServiceClientFactory;
|
||||
import org.openmetadata.service.exception.EntityNotFoundException;
|
||||
import org.openmetadata.service.jdbi3.AppRepository;
|
||||
import org.openmetadata.service.jdbi3.CollectionDAO;
|
||||
import org.openmetadata.service.jdbi3.IngestionPipelineRepository;
|
||||
@ -130,9 +131,7 @@ public class AppResource extends EntityResource<App, AppRepository> {
|
||||
null,
|
||||
createApp.getName(),
|
||||
new EntityUtil.Fields(repository.getMarketPlace().getAllowedFields()));
|
||||
App app =
|
||||
repository.getByName(
|
||||
null, createApp.getName(), repository.getFields("bot,pipelines"), ALL, false);
|
||||
App app = getAppForInit(createApp.getName());
|
||||
if (app == null) {
|
||||
app =
|
||||
getApplication(definition, createApp, "admin")
|
||||
@ -151,6 +150,14 @@ public class AppResource extends EntityResource<App, AppRepository> {
|
||||
}
|
||||
}
|
||||
|
||||
private App getAppForInit(String appName) {
|
||||
try {
|
||||
return repository.getByName(null, appName, repository.getFields("bot,pipelines"), ALL, false);
|
||||
} catch (EntityNotFoundException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public AppResource(Authorizer authorizer) {
|
||||
super(Entity.APPLICATION, authorizer);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user