Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Entity |
|
| 1.0;1 |
1 | package org.jtheque.core.managers.persistence.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.context.TemporaryContext; | |
20 | ||
21 | /** | |
22 | * An entity specification. | |
23 | * | |
24 | * @author Baptiste Wicht | |
25 | */ | |
26 | public interface Entity extends Comparable<Entity> { | |
27 | /** | |
28 | * Return the temporary context of the data. | |
29 | * | |
30 | * @return The temporary context of the data. | |
31 | */ | |
32 | TemporaryContext getTemporaryContext(); | |
33 | ||
34 | /** | |
35 | * Return the id of this Entity. | |
36 | * | |
37 | * @return The id | |
38 | */ | |
39 | int getId(); | |
40 | ||
41 | /** | |
42 | * Set the id of this Entity. | |
43 | * | |
44 | * @param id The new id to set | |
45 | */ | |
46 | void setId(int id); | |
47 | ||
48 | /** | |
49 | * Return a displayable text of the Entity. This is not the same as toString(). This method | |
50 | * provide an text of display on the application. | |
51 | * | |
52 | * @return A string representation of the Entity. | |
53 | */ | |
54 | String getDisplayableText(); | |
55 | ||
56 | /** | |
57 | * Indicate if the entity is saved or not. | |
58 | * | |
59 | * @return true if the entity is saved, else false. | |
60 | */ | |
61 | boolean isSaved(); | |
62 | ||
63 | /** | |
64 | * Save the state of the data object to a memento. By default this method isn't supported by Entity. | |
65 | */ | |
66 | void saveToMemento(); | |
67 | ||
68 | /** | |
69 | * Restore the state of the data object from the memento. By default this method isn't supported by Entity. | |
70 | */ | |
71 | void restoreMemento(); | |
72 | } |