[New] LogMessage constructor with I18nMessage

This commit is contained in:
Robert von Burg 2020-07-31 10:13:38 +02:00
parent f102e69fe8
commit 1eb2655669
2 changed files with 21 additions and 0 deletions

View File

@ -25,6 +25,20 @@ public class LogMessage extends I18nMessage {
private LogMessageState state;
private String stackTrace;
public LogMessage(String realm, String username, Locator locator, LogSeverity severity, LogMessageState state,
I18nMessage i18nMessage) {
super(i18nMessage);
this.id = StringHelper.getUniqueId();
// persisting in the DB only handles millisecond precision, not nano precision
ZonedDateTime now = ZonedDateTime.now();
this.zonedDateTime = now.withNano((now.getNano() / 1000000) * 1000000);
this.realm = realm;
this.username = username;
this.locator = locator;
this.severity = severity;
this.state = state;
}
public LogMessage(String realm, String username, Locator locator, LogSeverity severity, LogMessageState state,
ResourceBundle bundle, String key) {
super(bundle, key);

View File

@ -37,6 +37,13 @@ public class I18nMessage {
this.bundle = null;
}
public I18nMessage(I18nMessage i18nMessage) {
this.key = i18nMessage.key;
this.values = i18nMessage.values;
this.bundle = i18nMessage.bundle;
this.message = i18nMessage.message;
}
public String getKey() {
return this.key;
}