Skip to contentPackage: RoleCreatorImpl
RoleCreatorImpl
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.commons.model.AbstractKapuaNamedEntityCreator;
16: import org.eclipse.kapua.model.id.KapuaId;
17: import org.eclipse.kapua.service.authorization.permission.Permission;
18: import org.eclipse.kapua.service.authorization.role.Role;
19: import org.eclipse.kapua.service.authorization.role.RoleCreator;
20:
21: import java.util.HashSet;
22: import java.util.Set;
23:
24: /**
25: * {@link RoleCreator} implementation.
26: *
27: * @since 1.0.0
28: */
29: public class RoleCreatorImpl extends AbstractKapuaNamedEntityCreator<Role> implements RoleCreator {
30:
31: private static final long serialVersionUID = 972154225756734130L;
32:
33: private Set<Permission> permissions;
34:
35: /**
36: * Constructor
37: *
38: * @param scopeId The scope {@link KapuaId}
39: * @since 1.0.0
40: */
41: public RoleCreatorImpl(KapuaId scopeId) {
42: super(scopeId);
43: }
44:
45: @Override
46: public void setPermissions(Set<Permission> permissions) {
47: this.permissions = permissions;
48: }
49:
50: @Override
51: public Set<Permission> getPermissions() {
52:• if (permissions == null) {
53: permissions = new HashSet<>();
54: }
55: return permissions;
56: }
57:
58: }