Skip to content

Package: AccountFactoryImpl

AccountFactoryImpl

nameinstructionbranchcomplexitylinemethod
AccountFactoryImpl()
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(Account)
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: 6 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%
newOrganization()
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.account.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.account.Account;
19: import org.eclipse.kapua.service.account.AccountCreator;
20: import org.eclipse.kapua.service.account.AccountFactory;
21: import org.eclipse.kapua.service.account.AccountListResult;
22: import org.eclipse.kapua.service.account.AccountQuery;
23: import org.eclipse.kapua.service.account.Organization;
24:
25: /**
26: * {@link AccountFactory} implementation.
27: *
28: * @since 1.0.0
29: */
30: @KapuaProvider
31: public class AccountFactoryImpl implements AccountFactory {
32:
33: @Override
34: public AccountCreator newCreator(KapuaId scopeId) {
35: return new AccountCreatorImpl(scopeId, null);
36: }
37:
38: @Override
39: public AccountCreator newCreator(KapuaId scopeId, String name) {
40: AccountCreator creator = newCreator(scopeId);
41: creator.setName(name);
42: return creator;
43: }
44:
45: @Override
46: public Account newEntity(KapuaId scopeId) {
47: return new AccountImpl(scopeId);
48: }
49:
50: @Override
51: public Organization newOrganization() {
52: return new OrganizationImpl();
53: }
54:
55: @Override
56: public AccountQuery newQuery(KapuaId scopeId) {
57: return new AccountQueryImpl(scopeId);
58: }
59:
60: @Override
61: public AccountListResult newListResult() {
62: return new AccountListResultImpl();
63: }
64:
65: @Override
66: public Account clone(Account account) {
67: try {
68: return new AccountImpl(account);
69: } catch (Exception e) {
70: throw new KapuaEntityCloneException(e, Account.TYPE, account);
71: }
72: }
73: }