Skip to content

Package: GroupService

GroupService

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.group;
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: import org.eclipse.kapua.service.KapuaUpdatableEntityService;
20: import org.eclipse.kapua.service.config.KapuaConfigurableService;
21:
22: /**
23: * {@link Group} service definition.
24: *
25: * @since 1.0.0
26: */
27: public interface GroupService extends KapuaEntityService<Group, GroupCreator>,
28: KapuaUpdatableEntityService<Group>,
29: KapuaConfigurableService {
30:
31: /**
32: * Creates a new {@link Group} based on the parameters provided in the {@link GroupCreator}.<br>
33: * {@link Group} must have a unique name within the scope.
34: *
35: * @param groupCreator The creator object from which to create the {@link Group}.
36: * @return The created {@link Group}
37: * @throws KapuaException
38: * @since 1.0.0
39: */
40: @Override
41: Group create(GroupCreator groupCreator) throws KapuaException;
42:
43: /**
44: * Updates the {@link Group} according the given updated entity.<br>
45: * The {@link Group#getName()} can be updated, but must remain unique within the scope.
46: *
47: * @param group The updated {@link Group}.
48: * @return A {@link Group} with updated values.
49: * @throws KapuaException
50: * @since 1.0.0
51: */
52: @Override
53: Group update(Group group) throws KapuaException;
54:
55: /**
56: * Finds the {@link Group} by scope identifier and {@link Group} id.
57: *
58: * @param scopeId The scope id in which to search.
59: * @param groupId The {@link Group} id to search.
60: * @return The {@link Group} found or {@code null} if no entity was found.
61: * @throws KapuaException
62: * @since 1.0.0
63: */
64: @Override
65: Group find(KapuaId scopeId, KapuaId groupId) throws KapuaException;
66:
67: /**
68: * Returns the {@link GroupListResult} with elements matching the provided query.
69: *
70: * @param query The {@link GroupQuery} used to filter results.
71: * @return The {@link GroupListResult} with elements matching the query parameter.
72: * @throws KapuaException
73: * @since 1.0.0
74: */
75: @Override
76: GroupListResult query(KapuaQuery query) throws KapuaException;
77:
78: /**
79: * Returns the count of the {@link Group} elements matching the provided query.
80: *
81: * @param query The {@link GroupQuery} used to filter results.
82: * @return The count of the {@link Group} elements matching the provided query.
83: * @throws KapuaException
84: * @since 1.0.0
85: */
86: @Override
87: long count(KapuaQuery query) throws KapuaException;
88:
89: /**
90: * Delete the {@link Group} by scope id and {@link Group} id.
91: *
92: * @param scopeId The scope id in which to delete.
93: * @param groupId The {@link Group} id to delete.
94: * @throws KapuaException
95: * @since 1.0.0
96: */
97: @Override
98: void delete(KapuaId scopeId, KapuaId groupId) throws KapuaException;
99:
100: }