Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ITypesService |
|
| 1.0;1 |
1 | package org.jtheque.primary.services.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.DataContainer; | |
20 | import org.jtheque.primary.od.able.Type; | |
21 | ||
22 | import java.util.Collection; | |
23 | ||
24 | /** | |
25 | * A service for the types functions. | |
26 | * | |
27 | * @author Baptiste Wicht | |
28 | */ | |
29 | public interface ITypesService extends DataContainer<Type> { | |
30 | String DATA_TYPE = "Types"; | |
31 | ||
32 | /** | |
33 | * Return the default type. | |
34 | * | |
35 | * @return The default type | |
36 | */ | |
37 | Type getDefaultType(); | |
38 | ||
39 | /** | |
40 | * Return all the types. | |
41 | * | |
42 | * @return A List containing all the types. | |
43 | */ | |
44 | Collection<Type> getTypes(); | |
45 | ||
46 | /** | |
47 | * Create the type. | |
48 | * | |
49 | * @param type The type to create. | |
50 | */ | |
51 | void create(Type type); | |
52 | ||
53 | /** | |
54 | * Delete the type. | |
55 | * | |
56 | * @param type The type to delete. | |
57 | * @return true if the type has been deleted. | |
58 | */ | |
59 | boolean delete(Type type); | |
60 | ||
61 | /** | |
62 | * Save the type. | |
63 | * | |
64 | * @param type The type to save. | |
65 | */ | |
66 | void save(Type type); | |
67 | ||
68 | /** | |
69 | * Tests if the type exists or not. | |
70 | * | |
71 | * @param type The type to test. | |
72 | * @return <code>true</code> if the type exists else <code>false</code>. | |
73 | */ | |
74 | boolean exists(Type type); | |
75 | ||
76 | /** | |
77 | * Return the type with the specified name. | |
78 | * | |
79 | * @param name The searched name. | |
80 | * @return The type with the specified name if there is one else <code>null</code>. | |
81 | */ | |
82 | Type getType(String name); | |
83 | ||
84 | /** | |
85 | * Indicate if there is no types in the database. | |
86 | * | |
87 | * @return <code>true</code> if there is no type else <code>false</code>. | |
88 | */ | |
89 | boolean hasNoTypes(); | |
90 | ||
91 | /** | |
92 | * Create all the types. | |
93 | * | |
94 | * @param types The types to creates. | |
95 | */ | |
96 | void createAll(Iterable<Type> types); | |
97 | ||
98 | /** | |
99 | * Return an empty type. | |
100 | * | |
101 | * @return An empty type. | |
102 | */ | |
103 | Type getEmptyType(); | |
104 | } |