| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| IKindsService |
|
| 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.Kind; | |
| 21 | ||
| 22 | import java.util.Collection; | |
| 23 | ||
| 24 | /** | |
| 25 | * A kinds service specification. | |
| 26 | * | |
| 27 | * @author Baptiste Wicht | |
| 28 | */ | |
| 29 | public interface IKindsService extends DataContainer<Kind> { | |
| 30 | String DATA_TYPE = "Kinds"; | |
| 31 | ||
| 32 | /** | |
| 33 | * Return the default kind. | |
| 34 | * | |
| 35 | * @return The default kind. | |
| 36 | */ | |
| 37 | Kind getDefaultKind(); | |
| 38 | ||
| 39 | /** | |
| 40 | * Return the kinds. | |
| 41 | * | |
| 42 | * @return A List containing all the kinds. | |
| 43 | */ | |
| 44 | Collection<Kind> getKinds(); | |
| 45 | ||
| 46 | /** | |
| 47 | * Create the kind. | |
| 48 | * | |
| 49 | * @param kind The kind to create. | |
| 50 | */ | |
| 51 | void create(Kind kind); | |
| 52 | ||
| 53 | /** | |
| 54 | * Delete the kind. | |
| 55 | * | |
| 56 | * @param kind The kind to delete. | |
| 57 | * @return true if the kind has been deleted. | |
| 58 | */ | |
| 59 | boolean delete(Kind kind); | |
| 60 | ||
| 61 | /** | |
| 62 | * Save the kind. | |
| 63 | * | |
| 64 | * @param kind The kind to save. | |
| 65 | */ | |
| 66 | void save(Kind kind); | |
| 67 | ||
| 68 | /** | |
| 69 | * Return the kind with the name. | |
| 70 | * | |
| 71 | * @param name The name to search form. | |
| 72 | * @return The searched kind. | |
| 73 | */ | |
| 74 | Kind getKind(String name); | |
| 75 | ||
| 76 | /** | |
| 77 | * Indicate if exists a kind with the name. | |
| 78 | * | |
| 79 | * @param name The name of the kind. | |
| 80 | * @return true if the kind exists else false. | |
| 81 | */ | |
| 82 | boolean exists(String name); | |
| 83 | ||
| 84 | /** | |
| 85 | * Test the kind exists or not. | |
| 86 | * | |
| 87 | * @param kind The kind to test. | |
| 88 | * @return <code>true</code> if the kind exists else <code>false</code>. | |
| 89 | */ | |
| 90 | boolean exists(Kind kind); | |
| 91 | ||
| 92 | /** | |
| 93 | * Test if there is no kinds in the database. | |
| 94 | * | |
| 95 | * @return <code>true</code> if there is no kinds else <code>false</code>. | |
| 96 | */ | |
| 97 | boolean hasNoKinds(); | |
| 98 | ||
| 99 | /** | |
| 100 | * Create all the kinds. | |
| 101 | * | |
| 102 | * @param kinds The kinds to create. | |
| 103 | */ | |
| 104 | void createAll(Iterable<Kind> kinds); | |
| 105 | ||
| 106 | /** | |
| 107 | * Return an empty kind. | |
| 108 | * | |
| 109 | * @return An empty kind. | |
| 110 | */ | |
| 111 | Kind getEmptyKind(); | |
| 112 | } |