mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-29 02:45:25 +00:00
Refactoring
This commit is contained in:
parent
e9d202c959
commit
8a35bf3f28
@ -27,7 +27,6 @@ import jakarta.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@ -56,9 +55,8 @@ public class ElasticSearchEntityManager implements EntityManagementClient {
|
||||
public ElasticSearchEntityManager(ElasticsearchClient client) {
|
||||
this.client = client;
|
||||
this.isClientAvailable = client != null;
|
||||
if (this.isClientAvailable) {
|
||||
this.asyncClient = new ElasticsearchAsyncClient(this.client._transport());
|
||||
}
|
||||
this.asyncClient =
|
||||
this.isClientAvailable ? new ElasticsearchAsyncClient(this.client._transport()) : null;
|
||||
this.isAsyncClientAvailable = this.asyncClient != null;
|
||||
}
|
||||
|
||||
@ -340,7 +338,7 @@ public class ElasticSearchEntityManager implements EntityManagementClient {
|
||||
inline
|
||||
.lang(ScriptLanguage.Painless)
|
||||
.source(scriptTxt)
|
||||
.params(new HashMap<>()))),
|
||||
.params(Map.of()))),
|
||||
Map.class);
|
||||
LOG.info(
|
||||
"Successfully soft deleted/restored entity in ElasticSearch for index: {}, docId: {}",
|
||||
@ -383,7 +381,7 @@ public class ElasticSearchEntityManager implements EntityManagementClient {
|
||||
inline
|
||||
.lang(ScriptLanguage.Painless)
|
||||
.source(scriptTxt)
|
||||
.params(new HashMap<>())))
|
||||
.params(Map.of())))
|
||||
.refresh(true));
|
||||
|
||||
LOG.info(
|
||||
@ -453,7 +451,7 @@ public class ElasticSearchEntityManager implements EntityManagementClient {
|
||||
|
||||
try {
|
||||
Map<String, JsonData> params =
|
||||
convertToJsonDataMap(updates.getValue() == null ? new HashMap<>() : updates.getValue());
|
||||
convertToJsonDataMap(updates.getValue() == null ? Map.of() : updates.getValue());
|
||||
|
||||
client.updateByQuery(
|
||||
u ->
|
||||
@ -493,7 +491,7 @@ public class ElasticSearchEntityManager implements EntityManagementClient {
|
||||
|
||||
try {
|
||||
Map<String, JsonData> params =
|
||||
convertToJsonDataMap(updates.getValue() == null ? new HashMap<>() : updates.getValue());
|
||||
convertToJsonDataMap(updates.getValue() == null ? Map.of() : updates.getValue());
|
||||
|
||||
client.updateByQuery(
|
||||
u ->
|
||||
@ -564,7 +562,7 @@ public class ElasticSearchEntityManager implements EntityManagementClient {
|
||||
entityRelationshipData != null
|
||||
? Collections.singletonMap(
|
||||
"entityRelationshipData", JsonData.of(entityRelationshipData))
|
||||
: new HashMap<>();
|
||||
: Map.of();
|
||||
|
||||
UpdateByQueryResponse response =
|
||||
client.updateByQuery(
|
||||
|
@ -11,7 +11,6 @@ import jakarta.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@ -57,9 +56,8 @@ public class OpenSearchEntityManager implements EntityManagementClient {
|
||||
public OpenSearchEntityManager(OpenSearchClient client) {
|
||||
this.client = client;
|
||||
this.isClientAvailable = client != null;
|
||||
if (this.isClientAvailable) {
|
||||
this.asyncClient = new OpenSearchAsyncClient(this.client._transport());
|
||||
}
|
||||
this.asyncClient =
|
||||
this.isClientAvailable ? new OpenSearchAsyncClient(client._transport()) : null;
|
||||
this.isAsyncClientAvailable = this.asyncClient != null;
|
||||
}
|
||||
|
||||
@ -341,7 +339,7 @@ public class OpenSearchEntityManager implements EntityManagementClient {
|
||||
inline
|
||||
.lang(ScriptLanguage.Painless.jsonValue())
|
||||
.source(scriptTxt)
|
||||
.params(new HashMap<>()))),
|
||||
.params(Map.of()))),
|
||||
Map.class);
|
||||
LOG.info(
|
||||
"Successfully soft deleted/restored entity in OpenSearch for index: {}, docId: {}",
|
||||
@ -384,7 +382,7 @@ public class OpenSearchEntityManager implements EntityManagementClient {
|
||||
inline
|
||||
.lang(ScriptLanguage.Painless.jsonValue())
|
||||
.source(scriptTxt)
|
||||
.params(new HashMap<>())))
|
||||
.params(Map.of())))
|
||||
.refresh(true));
|
||||
|
||||
LOG.info(
|
||||
@ -453,7 +451,7 @@ public class OpenSearchEntityManager implements EntityManagementClient {
|
||||
|
||||
try {
|
||||
Map<String, JsonData> params =
|
||||
convertToJsonDataMap(updates.getValue() == null ? new HashMap<>() : updates.getValue());
|
||||
convertToJsonDataMap(updates.getValue() == null ? Map.of() : updates.getValue());
|
||||
|
||||
client.updateByQuery(
|
||||
u ->
|
||||
@ -493,7 +491,7 @@ public class OpenSearchEntityManager implements EntityManagementClient {
|
||||
|
||||
try {
|
||||
Map<String, JsonData> params =
|
||||
convertToJsonDataMap(updates.getValue() == null ? new HashMap<>() : updates.getValue());
|
||||
convertToJsonDataMap(updates.getValue() == null ? Map.of() : updates.getValue());
|
||||
|
||||
client.updateByQuery(
|
||||
u ->
|
||||
@ -564,7 +562,7 @@ public class OpenSearchEntityManager implements EntityManagementClient {
|
||||
entityRelationshipData != null
|
||||
? Collections.singletonMap(
|
||||
"entityRelationshipData", JsonData.of(entityRelationshipData))
|
||||
: new HashMap<>();
|
||||
: Map.of();
|
||||
|
||||
UpdateByQueryResponse response =
|
||||
client.updateByQuery(
|
||||
|
Loading…
x
Reference in New Issue
Block a user