Skip to content

Package: UserFactoryImpl

UserFactoryImpl

nameinstructionbranchcomplexitylinemethod
UserFactoryImpl()
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(User)
M: 13 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 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, String)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
newEntity(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%
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.user.internal;
14:
15: import org.eclipse.kapua.KapuaEntityCloneException;
16: import org.eclipse.kapua.locator.KapuaProvider;
17: import org.eclipse.kapua.model.id.KapuaId;
18: import org.eclipse.kapua.service.user.User;
19: import org.eclipse.kapua.service.user.UserCreator;
20: import org.eclipse.kapua.service.user.UserFactory;
21: import org.eclipse.kapua.service.user.UserListResult;
22: import org.eclipse.kapua.service.user.UserQuery;
23:
24: /**
25: * {@link UserFactory} implementation.
26: *
27: * @since 1.0.0
28: */
29: @KapuaProvider
30: public class UserFactoryImpl implements UserFactory {
31:
32: @Override
33: public UserCreator newCreator(KapuaId scopeId, String name) {
34: UserCreator creator = newCreator(scopeId);
35:
36: creator.setName(name);
37:
38: return creator;
39: }
40:
41: @Override
42: public UserQuery newQuery(KapuaId scopeId) {
43: return new UserQueryImpl(scopeId);
44: }
45:
46: @Override
47: public UserListResult newListResult() {
48: return new UserListResultImpl();
49: }
50:
51: @Override
52: public User newEntity(KapuaId scopeId) {
53: return new UserImpl(scopeId);
54: }
55:
56: @Override
57: public UserCreator newCreator(KapuaId scopeId) {
58: return new UserCreatorImpl(scopeId);
59: }
60:
61: @Override
62: public User clone(User user) {
63: try {
64: return new UserImpl(user);
65: } catch (Exception e) {
66: throw new KapuaEntityCloneException(e, User.TYPE, user);
67: }
68: }
69: }