Package: DeviceNotConnectedExceptionInfo
DeviceNotConnectedExceptionInfo
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DeviceNotConnectedExceptionInfo() |
|
|
|
|
|
||||||||||||||||||||
DeviceNotConnectedExceptionInfo(DeviceNotConnectedException) |
|
|
|
|
|
||||||||||||||||||||
getConnectionStatus() |
|
|
|
|
|
||||||||||||||||||||
getDeviceId() |
|
|
|
|
|
Coverage
1: /*******************************************************************************
2: * Copyright (c) 2021, 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.app.api.core.exception.model;
14:
15: import org.eclipse.kapua.model.id.KapuaId;
16: import org.eclipse.kapua.model.id.KapuaIdAdapter;
17: import org.eclipse.kapua.service.device.management.exception.DeviceNotConnectedException;
18: import org.eclipse.kapua.service.device.registry.connection.DeviceConnectionStatus;
19:
20: import javax.ws.rs.core.Response;
21: import javax.xml.bind.annotation.XmlAccessType;
22: import javax.xml.bind.annotation.XmlAccessorType;
23: import javax.xml.bind.annotation.XmlElement;
24: import javax.xml.bind.annotation.XmlRootElement;
25: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
26:
27: @XmlRootElement(name = "deviceNotConnectedExceptionInfo")
28: @XmlAccessorType(XmlAccessType.FIELD)
29: public class DeviceNotConnectedExceptionInfo extends ExceptionInfo {
30:
31: @XmlElement(name = "deviceId")
32: @XmlJavaTypeAdapter(KapuaIdAdapter.class)
33: private KapuaId deviceId;
34:
35: @XmlElement(name = "connectionStatus")
36: private DeviceConnectionStatus connectionStatus;
37:
38: protected DeviceNotConnectedExceptionInfo() {
39: // Required by JAXB
40: }
41:
42: public DeviceNotConnectedExceptionInfo(DeviceNotConnectedException deviceNotConnectedException) {
43: super(Response.Status.INTERNAL_SERVER_ERROR, deviceNotConnectedException.getCode(), deviceNotConnectedException);
44:
45: this.deviceId = deviceNotConnectedException.getDeviceId();
46: this.connectionStatus = deviceNotConnectedException.getCurrentConnectionStatus();
47: }
48:
49: public KapuaId getDeviceId() {
50: return deviceId;
51: }
52:
53: public DeviceConnectionStatus getConnectionStatus() {
54: return connectionStatus;
55: }
56: }