Skip to content

Package: DeviceEventFactoryImpl

DeviceEventFactoryImpl

nameinstructionbranchcomplexitylinemethod
DeviceEventFactoryImpl()
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%
clone(DeviceEvent)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
newCreator(KapuaId)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
newCreator(KapuaId, KapuaId, Date, String)
M: 22 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
newEntity(KapuaId)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
newListResult()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
newQuery(KapuaId)
M: 5 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.device.registry.event.internal;
14:
15: import org.eclipse.kapua.locator.KapuaProvider;
16: import org.eclipse.kapua.model.id.KapuaId;
17: import org.eclipse.kapua.service.device.management.message.KapuaMethod;
18: import org.eclipse.kapua.service.device.registry.event.DeviceEvent;
19: import org.eclipse.kapua.service.device.registry.event.DeviceEventCreator;
20: import org.eclipse.kapua.service.device.registry.event.DeviceEventFactory;
21: import org.eclipse.kapua.service.device.registry.event.DeviceEventListResult;
22: import org.eclipse.kapua.service.device.registry.event.DeviceEventQuery;
23:
24: import java.util.Date;
25:
26: /**
27: * {@link DeviceEventFactory} implementation.
28: *
29: * @since 1.0.0
30: */
31: @KapuaProvider
32: public class DeviceEventFactoryImpl implements DeviceEventFactory {
33:
34: @Override
35: public DeviceEventCreator newCreator(KapuaId scopeId, KapuaId deviceId, Date receivedOn, String resource) {
36: DeviceEventCreator creator = newCreator(scopeId);
37:
38: creator.setDeviceId(deviceId);
39: creator.setAction(KapuaMethod.CREATE);
40: creator.setReceivedOn(new Date(receivedOn.getTime()));
41: creator.setResource(resource);
42:
43: return creator;
44: }
45:
46: @Override
47: public DeviceEventQuery newQuery(KapuaId scopeId) {
48: return new DeviceEventQueryImpl(scopeId);
49: }
50:
51: @Override
52: public DeviceEvent newEntity(KapuaId scopeId) {
53: return new DeviceEventImpl();
54: }
55:
56: @Override
57: public DeviceEventCreator newCreator(KapuaId scopeId) {
58: return new DeviceEventCreatorImpl(scopeId);
59: }
60:
61: @Override
62: public DeviceEventListResult newListResult() {
63: return new DeviceEventListResultImpl();
64: }
65:
66: @Override
67: public DeviceEvent clone(DeviceEvent deviceEvent) {
68: return new DeviceEventImpl(deviceEvent);
69: }
70: }