Skip to content

Package: DeviceConnectionOptionDAO

DeviceConnectionOptionDAO

nameinstructionbranchcomplexitylinemethod
DeviceConnectionOptionDAO()
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%
count(EntityManager, KapuaQuery)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
find(EntityManager, KapuaId, KapuaId)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
query(EntityManager, KapuaQuery)
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
update(EntityManager, DeviceConnectionOption)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 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.device.registry.connection.option.internal;
14:
15: import org.eclipse.kapua.KapuaEntityNotFoundException;
16: import org.eclipse.kapua.KapuaException;
17: import org.eclipse.kapua.commons.jpa.EntityManager;
18: import org.eclipse.kapua.commons.service.internal.ServiceDAO;
19: import org.eclipse.kapua.model.id.KapuaId;
20: import org.eclipse.kapua.model.query.KapuaQuery;
21: import org.eclipse.kapua.service.device.registry.connection.option.DeviceConnectionOption;
22: import org.eclipse.kapua.service.device.registry.connection.option.DeviceConnectionOptionListResult;
23:
24: /**
25: * Device connection options DAO
26: *
27: * @since 1.0
28: */
29: public class DeviceConnectionOptionDAO extends ServiceDAO {
30:
31: /**
32: * Update the provided device connection options
33: *
34: * @param em
35: * @param deviceConnectionOptions
36: * @return
37: * @throws KapuaEntityNotFoundException If the {@link DeviceConnectionOption} is not found.
38: */
39: public static DeviceConnectionOption update(EntityManager em, DeviceConnectionOption deviceConnectionOptions)
40: throws KapuaException {
41: DeviceConnectionOptionImpl deviceConnectionOpptionsImpl = (DeviceConnectionOptionImpl) deviceConnectionOptions;
42: return ServiceDAO.update(em, DeviceConnectionOptionImpl.class, deviceConnectionOpptionsImpl);
43: }
44:
45: /**
46: * Find the device connection by device connection identifier
47: *
48: * @param em
49: * @param scopeId
50: * @param deviceConnectionOptionsId
51: * @return
52: */
53: public static DeviceConnectionOption find(EntityManager em, KapuaId scopeId, KapuaId deviceConnectionOptionsId) {
54: return ServiceDAO.find(em, DeviceConnectionOptionImpl.class, scopeId, deviceConnectionOptionsId);
55: }
56:
57: /**
58: * Return the device connection option list matching the provided query
59: *
60: * @param em
61: * @param query
62: * @return
63: * @throws KapuaException
64: */
65: public static DeviceConnectionOptionListResult query(EntityManager em, KapuaQuery query)
66: throws KapuaException {
67: return ServiceDAO.query(em, DeviceConnectionOption.class, DeviceConnectionOptionImpl.class, new DeviceConnectionOptionListResultImpl(), query);
68: }
69:
70: /**
71: * Return the device connection options count matching the provided query
72: *
73: * @param em
74: * @param query
75: * @return
76: * @throws KapuaException
77: */
78: public static long count(EntityManager em, KapuaQuery query)
79: throws KapuaException {
80: return ServiceDAO.count(em, DeviceConnectionOption.class, DeviceConnectionOptionImpl.class, query);
81: }
82: }