Skip to content

Package: RolePermissionService

RolePermissionService

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.KapuaException;
16: import org.eclipse.kapua.model.id.KapuaId;
17: import org.eclipse.kapua.model.query.KapuaQuery;
18: import org.eclipse.kapua.service.KapuaEntityService;
19:
20: /**
21: * {@link RolePermission} service definition.
22: *
23: * @since 1.0.0
24: */
25: public interface RolePermissionService extends KapuaEntityService<RolePermission, RolePermissionCreator> {
26:
27: /**
28: * Creates a new {@link RolePermission} based on the parameters provided in the {@link RolePermissionCreator}.<br>
29: * {@link RolePermission} must have a unique name within the scope.
30: *
31: * @param rolePermissionCreator The creator object from which to create the {@link RolePermission}.
32: * @throws KapuaException
33: * @since 1.0.0
34: */
35: @Override
36: RolePermission create(RolePermissionCreator rolePermissionCreator) throws KapuaException;
37:
38: /**
39: * Finds the {@link RolePermission} by scope identifier and {@link RolePermission} id.
40: *
41: * @param scopeId The scope id in which to search.
42: * @param rolePermissionId The {@link RolePermission} id to search.
43: * @return The {@link RolePermission} found or {@code null} if no entity was found.
44: * @throws KapuaException
45: * @since 1.0.0
46: */
47: @Override
48: RolePermission find(KapuaId scopeId, KapuaId rolePermissionId) throws KapuaException;
49:
50: /**
51: * Finds the {@link RolePermission}s by scope identifier and {@link Role} id.
52: *
53: * @param scopeId The scope id in which to search.
54: * @param roleId The {@link Role} id to search.
55: * @return The {@link RolePermission}s related to the {@link Role} id.
56: * @throws KapuaException
57: * @since 1.0.0
58: */
59: RolePermissionListResult findByRoleId(KapuaId scopeId, KapuaId roleId) throws KapuaException;
60:
61: /**
62: * Returns the {@link RolePermissionListResult} with elements matching the provided query.
63: *
64: * @param query The {@link RolePermissionQuery} used to filter results.
65: * @return The {@link RolePermissionListResult} with elements matching the query parameter.
66: * @throws KapuaException
67: * @since 1.0.0
68: */
69: @Override
70: RolePermissionListResult query(KapuaQuery query) throws KapuaException;
71:
72: /**
73: * Returns the count of the {@link RolePermission} elements matching the provided query.
74: *
75: * @param query The {@link RolePermissionQuery} used to filter results.
76: * @return The count of the {@link RolePermission} elements matching the provided query.
77: * @throws KapuaException
78: * @since 1.0.0
79: */
80: @Override
81: long count(KapuaQuery query) throws KapuaException;
82:
83: /**
84: * Delete the {@link RolePermission} by scope id and {@link RolePermission} id.
85: *
86: * @param scopeId The scope id in which to delete.
87: * @param rolePermissionId The {@link RolePermission} id to delete.
88: * @throws KapuaException
89: * @since 1.0.0
90: */
91: @Override
92: void delete(KapuaId scopeId, KapuaId rolePermissionId) throws KapuaException;
93:
94: }