Blame view

src/main/java/fr/plil/sio/persistence/api/GroupService.java 1.98 KB
a800fde0   jcartign   First version, in...
1
2
3
4
  package fr.plil.sio.persistence.api;
  
  public interface GroupService {
  
5418cb05   jcartign   Javadoc of API is...
5
6
      /**
       * Create a group with a specific name in the database.
b26b2e12   jcartign   Clarify Javadocs API
7
       * There is no two groups with the same name or the same ID in the database.
5418cb05   jcartign   Javadoc of API is...
8
9
10
11
       *
       * @param name the name of the group
       * @return an instance of the group
       * @throws IllegalArgumentException if name is null
f2ed17f6   jcartign   upgrading Javadoc
12
       * @throws IllegalStateException if a group with the same name is already present
5418cb05   jcartign   Javadoc of API is...
13
       */
a800fde0   jcartign   First version, in...
14
      Group create(String name);
f540a4bc   rvangrev   Fin TP
15
     
5418cb05   jcartign   Javadoc of API is...
16
17
18
19
20
21
22
23
      /**
       * Delete a group in the database. Remove all users in the group.
       *
       * @param name the name of the group to remove
       * @return true if group has been deleted, false if group is not found in the database.
       * @throws IllegalArgumentException if name is null
       */
      boolean delete(String name);
a800fde0   jcartign   First version, in...
24
  
5418cb05   jcartign   Javadoc of API is...
25
      /**
b26b2e12   jcartign   Clarify Javadocs API
26
       * Find a group in the database based on its name. Only references at one level are loaded (i.e. the users
c07d86ab   jcartign   Clarify API: remo...
27
       * who belong to the group).
5418cb05   jcartign   Javadoc of API is...
28
29
30
31
32
       *
       * @param name the name of the group to search for.
       * @return an instance of the group if found, else null.
       * @throws IllegalArgumentException if name is null
       */
a800fde0   jcartign   First version, in...
33
34
      Group findByName(String name);
  
5418cb05   jcartign   Javadoc of API is...
35
      /**
c07d86ab   jcartign   Clarify API: remo...
36
       * Add a right in the group.
5418cb05   jcartign   Javadoc of API is...
37
38
39
40
       *
       * @param groupName the name of the group.
       * @param right     the right to add
       * @return true if right is added in the group, false if right was already present.
5418cb05   jcartign   Javadoc of API is...
41
42
43
       * @throws IllegalArgumentException if groupName or right is null, or if group or right cannot be found.
       */
      boolean addRight(String groupName, Right right);
a800fde0   jcartign   First version, in...
44
  
5418cb05   jcartign   Javadoc of API is...
45
46
47
48
49
50
51
52
53
      /**
       * Remove a right associated with a group.
       *
       * @param groupName the name of the group.
       * @param right     the right to remove
       * @return true if right is removed from the group, false if teh right was not present in the group.
       * @throws IllegalArgumentException if groupName or right is null, or if group or right cannot be found.
       */
      boolean removeRight(String groupName, Right right);
a800fde0   jcartign   First version, in...
54
  }