Skip to content

Package: DeviceConnectionOptionImpl

DeviceConnectionOptionImpl

nameinstructionbranchcomplexitylinemethod
DeviceConnectionOptionImpl()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
DeviceConnectionOptionImpl(DeviceConnectionOption)
M: 16 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
DeviceConnectionOptionImpl(KapuaId)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getAllowUserChange()
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%
getReservedUserId()
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%
getUserCouplingMode()
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%
setAllowUserChange(boolean)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setReservedUserId(KapuaId)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setUserCouplingMode(ConnectionUserCouplingMode)
M: 4 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.KapuaException;
16: import org.eclipse.kapua.commons.model.AbstractKapuaUpdatableEntity;
17: import org.eclipse.kapua.commons.model.id.KapuaEid;
18: import org.eclipse.kapua.model.id.KapuaId;
19: import org.eclipse.kapua.service.device.registry.ConnectionUserCouplingMode;
20: import org.eclipse.kapua.service.device.registry.connection.option.DeviceConnectionOption;
21:
22: import javax.persistence.AttributeOverride;
23: import javax.persistence.AttributeOverrides;
24: import javax.persistence.Basic;
25: import javax.persistence.Column;
26: import javax.persistence.Embedded;
27: import javax.persistence.Entity;
28: import javax.persistence.EnumType;
29: import javax.persistence.Enumerated;
30: import javax.persistence.Table;
31:
32: /**
33: * {@link DeviceConnectionOption} implementation.
34: *
35: * @since 1.0.0
36: */
37: @Entity(name = "DeviceConnectionOptions")
38: @Table(name = "dvc_device_connection")
39: public class DeviceConnectionOptionImpl extends AbstractKapuaUpdatableEntity implements DeviceConnectionOption {
40:
41: private static final long serialVersionUID = 8928343233144731836L;
42:
43: @Basic
44: @Column(name = "allow_user_change", nullable = false, updatable = true)
45: private boolean allowUserChange;
46:
47: @Enumerated(EnumType.STRING)
48: @Column(name = "user_coupling_mode", nullable = false)
49: private ConnectionUserCouplingMode userCouplingMode;
50:
51: @Embedded
52: @AttributeOverrides({
53: @AttributeOverride(name = "eid", column = @Column(name = "reserved_user_id", nullable = true, updatable = true))
54: })
55: private KapuaEid reservedUserId;
56:
57: /**
58: * Constructor.
59: *
60: * @since 1.0.0
61: */
62: protected DeviceConnectionOptionImpl() {
63: super();
64: }
65:
66: /**
67: * Constructor
68: *
69: * @param scopeId The scope {@link KapuaId} to set into the {@link DeviceConnectionOption}
70: * @since 1.0.0
71: */
72: public DeviceConnectionOptionImpl(KapuaId scopeId) {
73: super(scopeId);
74: }
75:
76: /**
77: * Clone constructor.
78: *
79: * @param deviceConnectionOptions
80: * @throws KapuaException
81: * @since 1.0.0
82: */
83: public DeviceConnectionOptionImpl(DeviceConnectionOption deviceConnectionOptions) throws KapuaException {
84: super(deviceConnectionOptions);
85:
86: setAllowUserChange(deviceConnectionOptions.getAllowUserChange());
87: setUserCouplingMode(deviceConnectionOptions.getUserCouplingMode());
88: setReservedUserId(deviceConnectionOptions.getReservedUserId());
89: }
90:
91: @Override
92: public boolean getAllowUserChange() {
93: return allowUserChange;
94: }
95:
96: @Override
97: public void setAllowUserChange(boolean allowUserChange) {
98: this.allowUserChange = allowUserChange;
99: }
100:
101: @Override
102: public ConnectionUserCouplingMode getUserCouplingMode() {
103: return userCouplingMode;
104: }
105:
106: @Override
107: public void setUserCouplingMode(ConnectionUserCouplingMode userCouplingMode) {
108: this.userCouplingMode = userCouplingMode;
109: }
110:
111: @Override
112: public KapuaId getReservedUserId() {
113: return reservedUserId;
114: }
115:
116: @Override
117: public void setReservedUserId(KapuaId reservedUserId) {
118: this.reservedUserId = KapuaEid.parseKapuaId(reservedUserId);
119: }
120: }