a800fde0
jcartign
First version, in...
|
1
2
|
package fr.plil.sio.persistence.api;
|
5418cb05
jcartign
Javadoc of API is...
|
3
4
|
import java.util.List;
|
a800fde0
jcartign
First version, in...
|
5
6
|
public interface RightService {
|
5418cb05
jcartign
Javadoc of API is...
|
7
8
9
10
11
12
13
|
/**
* Create a parent right with a specific name in the database.
* It is possible that two rights has the same name.
*
* @param name the name of the right
* @throws IllegalArgumentException if name is null
*/
|
a800fde0
jcartign
First version, in...
|
14
15
|
Right create(String name);
|
5418cb05
jcartign
Javadoc of API is...
|
16
17
|
/**
* Create a sibling right attached to a parent right with a specific name in the database.
|
33ac96dc
jcartign
More in-lab fixes
|
18
|
* It is possible that two rights has the same name. Return only the right with the parent in the field parent.
|
c07d86ab
jcartign
Clarify API: remo...
|
19
|
*
|
5418cb05
jcartign
Javadoc of API is...
|
20
21
22
23
24
|
*
* @param name the name of the right
* @param parent the parent right
* @throws IllegalArgumentException if name or parent is null, or if parent does not exist in the database.
*/
|
a800fde0
jcartign
First version, in...
|
25
26
|
Right create(String name, Right parent);
|
5418cb05
jcartign
Javadoc of API is...
|
27
|
/**
|
f2ed17f6
jcartign
upgrading Javadoc
|
28
|
* Delete a right in the database. Delete sibling rights if present.
|
5418cb05
jcartign
Javadoc of API is...
|
29
30
|
*
* @param right the right to delete
|
f2ed17f6
jcartign
upgrading Javadoc
|
31
32
|
* @return true if right has been deleted, false else.
* @throws IllegalArgumentException if right is null.
|
5418cb05
jcartign
Javadoc of API is...
|
33
34
35
36
37
|
*/
boolean delete(Right right);
/**
* Find a list of rights in the database based on their name.
|
c07d86ab
jcartign
Clarify API: remo...
|
38
|
* All dependencies at one-level are loaded, i.e for each right returned the parent and sibling are present.
|
5418cb05
jcartign
Javadoc of API is...
|
39
40
41
42
43
44
|
*
* @param name the name of the rights to search for.
* @return A list of rights, eventually empty.
* @throws IllegalArgumentException if name is null
*/
List<Right> findByName(String name);
|
a800fde0
jcartign
First version, in...
|
45
|
|
5418cb05
jcartign
Javadoc of API is...
|
46
47
|
/**
* Find a right in the database based on its id.
|
c07d86ab
jcartign
Clarify API: remo...
|
48
|
* All dependencies at one-level are loaded, i.e the parent and sibling are present.
|
5418cb05
jcartign
Javadoc of API is...
|
49
50
51
52
53
54
|
*
* @param id the name of the right to search for.
* @return an instance of the right if found, else null.
* @throws IllegalArgumentException if id is null
*/
Right findOne(Long id);
|
a800fde0
jcartign
First version, in...
|
55
|
}
|