Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IDaoPersons |
|
| 1.0;1 |
1 | package org.jtheque.primary.dao.able; | |
2 | ||
3 | /* | |
4 | * This file is part of JTheque. | |
5 | * | |
6 | * JTheque is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License. | |
9 | * | |
10 | * JTheque is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | import org.jtheque.core.managers.persistence.able.JThequeDao; | |
20 | import org.jtheque.primary.od.able.Person; | |
21 | ||
22 | import java.util.Collection; | |
23 | ||
24 | /** | |
25 | * A DAO for persons specification. | |
26 | * | |
27 | * @author Baptiste Wicht | |
28 | */ | |
29 | public interface IDaoPersons extends JThequeDao { | |
30 | String TABLE = "T_PERSONS"; | |
31 | ||
32 | /** | |
33 | * Return all the persons. | |
34 | * | |
35 | * @param type The type of persons to search for. | |
36 | * | |
37 | * @return All the persons. | |
38 | */ | |
39 | Collection<Person> getPersons(String type); | |
40 | ||
41 | /** | |
42 | * Return the person of the specified id. | |
43 | * | |
44 | * @param id The person borrower id. | |
45 | * | |
46 | * @return The person corresponding the id or <code>null</code> if there is no person with this id. | |
47 | */ | |
48 | Person getPerson(int id); | |
49 | ||
50 | /** | |
51 | * Return the person with the specified name and first name. | |
52 | * | |
53 | * @param firstName The searched first name. | |
54 | * @param name The searched name. | |
55 | * @param type The type of persons to search for. | |
56 | * | |
57 | * @return The person if there is no for this arguments else <code>null</code>. | |
58 | */ | |
59 | Person getPerson(String firstName, String name, String type); | |
60 | ||
61 | /** | |
62 | * Indicate if a person with this firstName and this name exists in the application. | |
63 | * | |
64 | * @param firstName The searched first name. | |
65 | * @param name The searched name. | |
66 | * @param type The type of persons to search for. | |
67 | * | |
68 | * @return <code>true</code> if an person exist with first name and this name else <code>false</code>. | |
69 | */ | |
70 | boolean exists(String firstName, String name, String type); | |
71 | ||
72 | /** | |
73 | * Indicate if the person exist in the Dao. | |
74 | * | |
75 | * @param person The person we must test if it's exist. | |
76 | * | |
77 | * @return <code>true</code> if the person exists else <code>false</code>. | |
78 | */ | |
79 | boolean exist(Person person); | |
80 | ||
81 | /** | |
82 | * Create a new person. | |
83 | * | |
84 | * @param person The new person | |
85 | */ | |
86 | void create(Person person); | |
87 | ||
88 | /** | |
89 | * Save the person. | |
90 | * | |
91 | * @param person The person to save. | |
92 | */ | |
93 | void save(Person person); | |
94 | ||
95 | /** | |
96 | * Delete a person. | |
97 | * | |
98 | * @param person The person to delete. | |
99 | * | |
100 | * @return <code>true</code> if the object is deleted else <code>false</code>. | |
101 | */ | |
102 | boolean delete(Person person); | |
103 | ||
104 | /** | |
105 | * Create a person. | |
106 | * | |
107 | * @return A created empty person. | |
108 | */ | |
109 | Person createPerson(); | |
110 | ||
111 | /** | |
112 | * Clear all the entities with the specified type. | |
113 | * | |
114 | * @param type The type of entities to delete. | |
115 | */ | |
116 | void clearAll(String type); | |
117 | } |