Skip to content

Package: DeviceConnectionImpl

DeviceConnectionImpl

nameinstructionbranchcomplexitylinemethod
DeviceConnectionImpl()
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%
DeviceConnectionImpl(DeviceConnection)
M: 40 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 11 C: 0
0%
M: 1 C: 0
0%
DeviceConnectionImpl(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%
getClientId()
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%
getClientIp()
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%
getProtocol()
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%
getServerIp()
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%
getStatus()
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%
getUserId()
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%
setClientId(String)
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%
setClientIp(String)
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%
setProtocol(String)
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%
setServerIp(String)
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%
setStatus(DeviceConnectionStatus)
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%
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%
setUserId(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%

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.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.DeviceConnection;
21: import org.eclipse.kapua.service.device.registry.connection.DeviceConnectionStatus;
22:
23: import javax.persistence.AttributeOverride;
24: import javax.persistence.AttributeOverrides;
25: import javax.persistence.Basic;
26: import javax.persistence.Column;
27: import javax.persistence.Embedded;
28: import javax.persistence.Entity;
29: import javax.persistence.EnumType;
30: import javax.persistence.Enumerated;
31: import javax.persistence.Table;
32:
33: /**
34: * {@link DeviceConnection} implementation.
35: *
36: * @since 1.0.0
37: */
38: @Entity(name = "DeviceConnection")
39: @Table(name = "dvc_device_connection")
40: public class DeviceConnectionImpl extends AbstractKapuaUpdatableEntity implements DeviceConnection {
41:
42: private static final long serialVersionUID = 8928343233144731836L;
43:
44: @Enumerated(EnumType.STRING)
45: @Column(name = "status", nullable = false, updatable = true)
46: private DeviceConnectionStatus status;
47:
48: @Basic
49: @Column(name = "client_id", nullable = false, updatable = false)
50: private String clientId;
51:
52: @Embedded
53: @AttributeOverrides({
54: @AttributeOverride(name = "eid", column = @Column(name = "user_id", nullable = false, updatable = true))
55: })
56: private KapuaEid userId;
57:
58: @Basic
59: @Column(name = "allow_user_change", nullable = false, updatable = true)
60: private boolean allowUserChange;
61:
62: @Enumerated(EnumType.STRING)
63: @Column(name = "user_coupling_mode", nullable = false)
64: private ConnectionUserCouplingMode userCouplingMode;
65:
66: @Embedded
67: @AttributeOverrides({
68: @AttributeOverride(name = "eid", column = @Column(name = "reserved_user_id", nullable = true, updatable = true))
69: })
70: private KapuaEid reservedUserId;
71:
72: @Basic
73: @Column(name = "protocol", nullable = false)
74: private String protocol;
75:
76: @Basic
77: @Column(name = "client_ip")
78: private String clientIp;
79:
80: @Basic
81: @Column(name = "server_ip")
82: private String serverIp;
83:
84: /**
85: * Constructor
86: *
87: * @since 1.0.0
88: */
89: protected DeviceConnectionImpl() {
90: super();
91: }
92:
93: /**
94: * Constructor
95: *
96: * @param scopeId
97: * @since 1.0.0
98: */
99: public DeviceConnectionImpl(KapuaId scopeId) {
100: super(scopeId);
101: }
102:
103: /**
104: * Clone constructor.
105: *
106: * @param deviceConnection
107: * @throws KapuaException
108: * @since 1.0.0
109: */
110: public DeviceConnectionImpl(DeviceConnection deviceConnection) throws KapuaException {
111: super(deviceConnection);
112:
113: setStatus(deviceConnection.getStatus());
114: setClientId(deviceConnection.getClientId());
115: setUserId(deviceConnection.getUserId());
116: setAllowUserChange(deviceConnection.getAllowUserChange());
117: setUserCouplingMode(deviceConnection.getUserCouplingMode());
118: setReservedUserId(deviceConnection.getReservedUserId());
119: setProtocol(deviceConnection.getProtocol());
120: setClientIp(deviceConnection.getClientIp());
121: setServerIp(deviceConnection.getServerIp());
122: }
123:
124: @Override
125: public DeviceConnectionStatus getStatus() {
126: return status;
127: }
128:
129: @Override
130: public void setStatus(DeviceConnectionStatus connectionStatus) {
131: this.status = connectionStatus;
132: }
133:
134: @Override
135: public String getClientId() {
136: return clientId;
137: }
138:
139: @Override
140: public void setClientId(String clientId) {
141: this.clientId = clientId;
142: }
143:
144: @Override
145: public KapuaId getUserId() {
146: return userId;
147: }
148:
149: @Override
150: public void setUserId(KapuaId userId) {
151: this.userId = KapuaEid.parseKapuaId(userId);
152: }
153:
154: @Override
155: public boolean getAllowUserChange() {
156: return allowUserChange;
157: }
158:
159: @Override
160: public void setAllowUserChange(boolean allowUserChange) {
161: this.allowUserChange = allowUserChange;
162: }
163:
164: @Override
165: public ConnectionUserCouplingMode getUserCouplingMode() {
166: return userCouplingMode;
167: }
168:
169: @Override
170: public void setUserCouplingMode(ConnectionUserCouplingMode userCouplingMode) {
171: this.userCouplingMode = userCouplingMode;
172: }
173:
174: @Override
175: public KapuaId getReservedUserId() {
176: return reservedUserId;
177: }
178:
179: @Override
180: public void setReservedUserId(KapuaId reservedUserId) {
181: this.reservedUserId = KapuaEid.parseKapuaId(reservedUserId);
182: }
183:
184: @Override
185: public String getProtocol() {
186: return protocol;
187: }
188:
189: @Override
190: public void setProtocol(String protocol) {
191: this.protocol = protocol;
192: }
193:
194: @Override
195: public String getClientIp() {
196: return clientIp;
197: }
198:
199: @Override
200: public void setClientIp(String clientIp) {
201: this.clientIp = clientIp;
202: }
203:
204: @Override
205: public String getServerIp() {
206: return serverIp;
207: }
208:
209: @Override
210: public void setServerIp(String serverIp) {
211: this.serverIp = serverIp;
212: }
213: }