| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| EventLog |
|
| 1.0;1 |
| 1 | package org.jtheque.core.managers.event; | |
| 2 | ||
| 3 | import java.util.Date; | |
| 4 | ||
| 5 | /* | |
| 6 | * This file is part of JTheque. | |
| 7 | * | |
| 8 | * JTheque is free software: you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation, either version 3 of the License. | |
| 11 | * | |
| 12 | * JTheque is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
| 19 | */ | |
| 20 | ||
| 21 | /** | |
| 22 | * An event log. | |
| 23 | * | |
| 24 | * @author Baptiste Wicht | |
| 25 | */ | |
| 26 | public final class EventLog { | |
| 27 | private final EventLevel level; | |
| 28 | private final Date date; | |
| 29 | private final String source; | |
| 30 | private final String titleKey; | |
| 31 | private String log; | |
| 32 | private String detailsKey; | |
| 33 | ||
| 34 | /** | |
| 35 | * Construct a new EventLog. | |
| 36 | * | |
| 37 | * @param level The level of the event. | |
| 38 | * @param source The source of the event. | |
| 39 | * @param titleKey The internationalization key of the title. | |
| 40 | */ | |
| 41 | public EventLog(EventLevel level, String source, String titleKey) { | |
| 42 | 0 | this(level, new Date(), source, titleKey); |
| 43 | 0 | } |
| 44 | ||
| 45 | /** | |
| 46 | * Construct a new EventLog. | |
| 47 | * | |
| 48 | * @param level The level of the event. | |
| 49 | * @param date The date of the event. | |
| 50 | * @param source The source of the event. | |
| 51 | * @param titleKey The internationalization key of the title. | |
| 52 | */ | |
| 53 | public EventLog(EventLevel level, Date date, String source, String titleKey) { | |
| 54 | 0 | super(); |
| 55 | ||
| 56 | 0 | this.level = level; |
| 57 | 0 | this.date = new Date(date.getTime()); |
| 58 | 0 | this.source = source; |
| 59 | 0 | this.titleKey = titleKey; |
| 60 | 0 | } |
| 61 | ||
| 62 | /** | |
| 63 | * Return the log of the event. | |
| 64 | * | |
| 65 | * @return The log of the event. | |
| 66 | */ | |
| 67 | public String getLog() { | |
| 68 | 0 | return log; |
| 69 | } | |
| 70 | ||
| 71 | /** | |
| 72 | * Set the log of the event. | |
| 73 | * | |
| 74 | * @param log The log of the event. | |
| 75 | */ | |
| 76 | public void setLog(String log) { | |
| 77 | 0 | this.log = log; |
| 78 | 0 | } |
| 79 | ||
| 80 | /** | |
| 81 | * Return the details internationalization key. | |
| 82 | * | |
| 83 | * @return The details internationalization key. | |
| 84 | */ | |
| 85 | public String getDetailsKey() { | |
| 86 | 0 | return detailsKey; |
| 87 | } | |
| 88 | ||
| 89 | /** | |
| 90 | * Set the details internationalization key. | |
| 91 | * | |
| 92 | * @param detailsKey The details internationalization key. | |
| 93 | */ | |
| 94 | public void setDetailsKey(String detailsKey) { | |
| 95 | 0 | this.detailsKey = detailsKey; |
| 96 | 0 | } |
| 97 | ||
| 98 | /** | |
| 99 | * Return the level of the event. | |
| 100 | * | |
| 101 | * @return The level of the event. | |
| 102 | */ | |
| 103 | public EventLevel getLevel() { | |
| 104 | 0 | return level; |
| 105 | } | |
| 106 | ||
| 107 | /** | |
| 108 | * Return the date of the event. | |
| 109 | * | |
| 110 | * @return The date of the event. | |
| 111 | */ | |
| 112 | public Date getDate() { | |
| 113 | 0 | return (Date) date.clone(); |
| 114 | } | |
| 115 | ||
| 116 | /** | |
| 117 | * Return the source of the event. | |
| 118 | * | |
| 119 | * @return The source of the event. | |
| 120 | */ | |
| 121 | public String getSource() { | |
| 122 | 0 | return source; |
| 123 | } | |
| 124 | ||
| 125 | /** | |
| 126 | * Return the title internationalization key. | |
| 127 | * | |
| 128 | * @return The title internationalization key. | |
| 129 | */ | |
| 130 | public String getTitleKey() { | |
| 131 | 0 | return titleKey; |
| 132 | } | |
| 133 | } |