Skip to content

Package: SchemaUtil

SchemaUtil

nameinstructionbranchcomplexitylinemethod
getChannelIndexName(KapuaId)
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getClientIndexName(KapuaId)
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getDataIndexName(KapuaId)
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getMapOfMap(String, String[], String[])
M: 32 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getMetricIndexName(KapuaId)
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2016, 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.datastore.internal.schema;
14:
15: import org.eclipse.kapua.model.id.KapuaId;
16: import org.eclipse.kapua.service.datastore.internal.mediator.DatastoreUtils;
17:
18: import java.util.HashMap;
19: import java.util.Map;
20:
21: /**
22: * Schema utility class
23: *
24: * @since 1.0.0
25: */
26: public class SchemaUtil {
27:
28:
29: /**
30: * @since 1.0.0
31: */
32: private SchemaUtil() {
33: }
34:
35: /**
36: * Return a map of map. The contained map has, as entries, the couples subKeys-values.<br>
37: * <b>NOTE! No arrays subKeys-values coherence will be done (length or null check)!</b>
38: *
39: * @param key
40: * @param subKeys
41: * @param values
42: * @return
43: * @since 1.0.0
44: */
45: public static Map<String, Object> getMapOfMap(String key, String[] subKeys, String[] values) {
46: Map<String, String> mapChildren = new HashMap<>();
47:• for (int i = 0; i < subKeys.length; i++) {
48: mapChildren.put(subKeys[i], values[i]);
49: }
50: Map<String, Object> map = new HashMap<>();
51: map.put(key, mapChildren);
52: return map;
53: }
54:
55: /**
56: * Get the Elasticsearch data index name
57: *
58: * @param scopeId
59: * @return
60: * @since 1.0.0
61: */
62: public static String getDataIndexName(KapuaId scopeId) {
63: return DatastoreUtils.getDataIndexName(scopeId);
64: }
65:
66: /**
67: * Get the Kapua data index name
68: *
69: * @param scopeId
70: * @return
71: * @since 1.0.0
72: */
73: public static String getChannelIndexName(KapuaId scopeId) {
74: return DatastoreUtils.getChannelIndexName(scopeId);
75: }
76:
77: /**
78: * Get the Kapua data index name
79: *
80: * @param scopeId
81: * @return
82: */
83: public static String getClientIndexName(KapuaId scopeId) {
84: return DatastoreUtils.getClientIndexName(scopeId);
85: }
86:
87: /**
88: * Get the Kapua data index name
89: *
90: * @param scopeId
91: * @return
92: */
93: public static String getMetricIndexName(KapuaId scopeId) {
94: return DatastoreUtils.getMetricIndexName(scopeId);
95: }
96:
97: }