Skip to content

Package: QueryConverter

QueryConverter

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.elasticsearch.client;
14:
15: import com.fasterxml.jackson.databind.JsonNode;
16: import org.eclipse.kapua.service.elasticsearch.client.exception.QueryMappingException;
17:
18: /**
19: * {@link QueryConverter} definition.
20: * <p>
21: * This object is responsible for translating datastore query model to client query.
22: *
23: * @since 1.0.0
24: */
25: public interface QueryConverter {
26:
27: /**
28: * Query fetch style key
29: *
30: * @since 1.0.0
31: */
32: String QUERY_FETCH_STYLE_KEY = "query_fetch_style";
33:
34: /**
35: * Converts the Elasticsearch query to the client query
36: *
37: * @param query The queyr to convert.
38: * @return The converted query.
39: * @throws QueryMappingException if query mappings are not correst.
40: * @since 1.0.0
41: */
42: JsonNode convertQuery(Object query) throws QueryMappingException;
43:
44: /**
45: * Gets the query fetch style
46: *
47: * @param query The query fetch style
48: * @return The query fetch style
49: * @throws QueryMappingException if query mappings are not correct.
50: * @since 1.0.0
51: */
52: Object getFetchStyle(Object query) throws QueryMappingException;
53:
54: }