| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| SimpleData |
|
| 1.0;1 | ||||
| SimpleData$DataType |
|
| 1.0;1 |
| 1 | package org.jtheque.primary.od.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 | /** | |
| 20 | * A simple data specification. | |
| 21 | * | |
| 22 | * @author Baptiste Wicht | |
| 23 | */ | |
| 24 | public interface SimpleData extends Data { | |
| 25 | /** | |
| 26 | * The data type of the simple datas. | |
| 27 | * | |
| 28 | * @author Baptiste Wicht | |
| 29 | */ | |
| 30 | 0 | enum DataType { |
| 31 | 0 | LANGUAGE("T_LANGUAGES", "Languages", false), |
| 32 | 0 | COUNTRY("T_COUNTRIES", "Countries", false), |
| 33 | 0 | KIND("T_KINDS", "Kinds", true), |
| 34 | 0 | SAGA("T_SAGAS", "Sagas", true), |
| 35 | 0 | TYPE("T_TYPES", "Types", true); |
| 36 | ||
| 37 | private final String table; | |
| 38 | private final String dataType; | |
| 39 | private final boolean primary; | |
| 40 | ||
| 41 | /** | |
| 42 | * Construct a new DataType. | |
| 43 | * | |
| 44 | * @param table The table in the database. | |
| 45 | * @param dataType The data type. | |
| 46 | * @param primary Indicate if the simple data is a primary data or not. | |
| 47 | */ | |
| 48 | 0 | DataType(String table, String dataType, boolean primary){ |
| 49 | 0 | this.table = table; |
| 50 | 0 | this.dataType = dataType; |
| 51 | 0 | this.primary = primary; |
| 52 | 0 | } |
| 53 | ||
| 54 | /** | |
| 55 | * Return the table in the database of this data type. | |
| 56 | * | |
| 57 | * @return The table | |
| 58 | */ | |
| 59 | public String getTable(){ | |
| 60 | 0 | return table; |
| 61 | } | |
| 62 | ||
| 63 | /** | |
| 64 | * Indicate if this data type refer to a primary data or not. | |
| 65 | * | |
| 66 | * @return true if this data type refers to a primary data else false. | |
| 67 | */ | |
| 68 | public boolean isPrimary(){ | |
| 69 | 0 | return primary; |
| 70 | } | |
| 71 | ||
| 72 | /** | |
| 73 | * Return the data type of this data type. | |
| 74 | * | |
| 75 | * @return The data type of this data type. | |
| 76 | */ | |
| 77 | public String getDataType(){ | |
| 78 | 0 | return dataType; |
| 79 | } | |
| 80 | } | |
| 81 | ||
| 82 | /** | |
| 83 | * Return the name of the type. | |
| 84 | * | |
| 85 | * @return The name of the type. | |
| 86 | */ | |
| 87 | String getName(); | |
| 88 | ||
| 89 | /** | |
| 90 | * Set the name of the type. | |
| 91 | * | |
| 92 | * @param name The name of the type. | |
| 93 | */ | |
| 94 | void setName(String name); | |
| 95 | ||
| 96 | /** | |
| 97 | * Return the data type of the simple data. | |
| 98 | * | |
| 99 | * @return The data type of this simple data. | |
| 100 | */ | |
| 101 | DataType getType(); | |
| 102 | } |