Skip to contentPackage: RoleFactoryImpl
RoleFactoryImpl
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.authorization.role.shiro;
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.authorization.role.Role;
19: import org.eclipse.kapua.service.authorization.role.RoleCreator;
20: import org.eclipse.kapua.service.authorization.role.RoleFactory;
21: import org.eclipse.kapua.service.authorization.role.RoleListResult;
22: import org.eclipse.kapua.service.authorization.role.RolePermission;
23: import org.eclipse.kapua.service.authorization.role.RoleQuery;
24:
25: /**
26: * {@link RoleFactory} implementation.
27: *
28: * @since 1.0.0
29: */
30: @KapuaProvider
31: public class RoleFactoryImpl implements RoleFactory {
32:
33: @Override
34: public Role newEntity(KapuaId scopeId) {
35: return new RoleImpl(scopeId);
36: }
37:
38: @Override
39: public RoleCreator newCreator(KapuaId scopeId) {
40: return new RoleCreatorImpl(scopeId);
41: }
42:
43: @Override
44: public RoleQuery newQuery(KapuaId scopeId) {
45: return new RoleQueryImpl(scopeId);
46: }
47:
48: @Override
49: public RoleListResult newListResult() {
50: return new RoleListResultImpl();
51: }
52:
53: @Override
54: public RolePermission newRolePermission() {
55: return new RolePermissionImpl();
56: }
57:
58: @Override
59: public Role clone(Role role) {
60: try {
61: return new RoleImpl(role);
62: } catch (Exception e) {
63: throw new KapuaEntityCloneException(e, Role.TYPE, role);
64: }
65: }
66: }