Skip to content

Package: RolePermissionCreator

RolePermissionCreator

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;
14:
15: import org.eclipse.kapua.model.KapuaEntityCreator;
16: import org.eclipse.kapua.model.id.KapuaId;
17: import org.eclipse.kapua.model.id.KapuaIdAdapter;
18: import org.eclipse.kapua.service.authorization.permission.Permission;
19:
20: import javax.xml.bind.annotation.XmlAccessType;
21: import javax.xml.bind.annotation.XmlAccessorType;
22: import javax.xml.bind.annotation.XmlElement;
23: import javax.xml.bind.annotation.XmlRootElement;
24: import javax.xml.bind.annotation.XmlType;
25: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
26:
27: /**
28: * {@link RolePermission} creator definition.<br>
29: * It is used to create a new {@link RolePermission}.
30: *
31: * @since 1.0.0
32: */
33: @XmlRootElement(name = "rolePermissionCreator")
34: @XmlAccessorType(XmlAccessType.PROPERTY)
35: @XmlType(propOrder = { "roleId", "permission" },//
36: factoryClass = RolePermissionXmlRegistry.class, factoryMethod = "newCreator")
37: public interface RolePermissionCreator extends KapuaEntityCreator<RolePermission> {
38:
39: /**
40: * Sets the {@link Role} id for this {@link RolePermission}.
41: *
42: * @param roleId The {@link Role} id for this {@link RolePermission}.
43: * @since 1.0.0
44: */
45: void setRoleId(KapuaId roleId);
46:
47: /**
48: * Gets the {@link Role} id of this {@link RolePermission}.
49: *
50: * @return The {@link Role} id of this {@link RolePermission}.
51: * @since 1.0.0
52: */
53: @XmlElement(name = "roleId")
54: @XmlJavaTypeAdapter(KapuaIdAdapter.class)
55: KapuaId getRoleId();
56:
57: /**
58: * Sets the {@link Permission} to assign to the {@link RolePermission} created entity.
59: * It up to the implementation class to make a clone of the object or use the given object.
60: *
61: * @param permission The {@link Permission}.
62: * @since 1.0.0
63: */
64: void setPermission(Permission permission);
65:
66: /**
67: * Gets the set of {@link Permission} added to this {@link RolePermission}.
68: *
69: * @return The set of {@link Permission}.
70: * @since 1.0.0
71: */
72: @XmlElement(name = "permission")
73: <P extends Permission> P getPermission();
74: }