Compare commits
1
Commits
dev
...
module/journal
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f0dced606 |
@@ -5,6 +5,7 @@ import static de.srsoftware.umbrella.core.constants.Module.BOOKMARK;
|
||||
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
||||
|
||||
import de.srsoftware.umbrella.core.constants.Field;
|
||||
import de.srsoftware.umbrella.core.constants.Text;
|
||||
import de.srsoftware.umbrella.core.model.Bookmark;
|
||||
import de.srsoftware.umbrella.core.model.Translatable;
|
||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||
@@ -22,19 +23,42 @@ public class BookmarkEvent extends Event<Bookmark> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Translatable describe(boolean verbose) {
|
||||
return switch (eventType()){
|
||||
case CREATE -> t("New bookmark created");
|
||||
case DELETE -> t("The bookmark '{url}' has been deleted", Field.URL, payload().url());
|
||||
case UPDATE -> t("Bookmark updated");
|
||||
default -> null;
|
||||
};
|
||||
public Translatable describeCreate(boolean verbose) {
|
||||
return t(Text.CREATE_BOOKMARK_DESCRIPTION,Field.URL,payload().url(),Field.DESCRIPTION,payload().comment());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Translatable subject() {
|
||||
return describe(false);
|
||||
public Translatable describeDelete(boolean verbose) {
|
||||
return t(Text.DELETE_BOOKMARK_DESCRIPTION, Field.DESCRIPTION, payload().comment());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Translatable describeMemberAdded(boolean verbose) {
|
||||
return t(Text.MEMBER_ADDED_TO_BM_DESC,Field.DESCRIPTION,payload().comment());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Translatable describeUpdate(boolean verbose) {
|
||||
return t(Text.UPDATE_BM_DESCRIPTION, Field.USER, initiator().name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Translatable subjectCreate() {
|
||||
return t(Text.CREATE_BOOKMARK_SUBJECT,Field.USER,initiator().name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Translatable subjectDelete() {
|
||||
return t(Text.DELETE_BOOKMARK_SUBJECT, Field.USER, initiator().name(), Field.URL, payload().url());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Translatable subjectMemberAdded() {
|
||||
return t(Text.MEMBER_ADDED_TO_BM_SUBJ,Field.USER, initiator().name(), Field.URL, payload().url());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Translatable subjectUpdate() {
|
||||
return t(Text.UPDATE_BM_SUBJECT,Field.URL, payload().url(), Field.DESCRIPTION, diff().orElse(""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
package de.srsoftware.umbrella.messagebus.events;
|
||||
|
||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
||||
import static java.util.Optional.*;
|
||||
|
||||
import de.srsoftware.tools.Diff;
|
||||
import de.srsoftware.umbrella.core.constants.Field;
|
||||
import de.srsoftware.umbrella.core.model.Translatable;
|
||||
import de.srsoftware.umbrella.core.model.UmbrellaObject;
|
||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||
@@ -47,7 +49,19 @@ public abstract class Event<Payload extends UmbrellaObject> {
|
||||
|
||||
public abstract Collection<UmbrellaUser> audience();
|
||||
|
||||
public abstract Translatable describe(boolean verbose);
|
||||
public Translatable describe(boolean verbose) {
|
||||
return switch (eventType()){
|
||||
case CREATE -> describeCreate(verbose);
|
||||
case DELETE -> describeDelete(verbose);
|
||||
case MEMBER_ADDED -> describeMemberAdded(verbose);
|
||||
case UPDATE -> describeUpdate(verbose);
|
||||
};
|
||||
}
|
||||
|
||||
public abstract Translatable describeCreate(boolean verbose);
|
||||
public abstract Translatable describeDelete(boolean verbose);
|
||||
public abstract Translatable describeMemberAdded(boolean verbose);
|
||||
public abstract Translatable describeUpdate(boolean verbose);
|
||||
|
||||
private Map<String, Object> dropMarkdown(Map<String, Object> map) {
|
||||
var result = new HashMap<String, Object>();
|
||||
@@ -110,5 +124,18 @@ public abstract class Event<Payload extends UmbrellaObject> {
|
||||
return payload;
|
||||
}
|
||||
|
||||
public abstract Translatable subject();
|
||||
public Translatable subject() {
|
||||
return switch (eventType()){
|
||||
case CREATE -> subjectCreate();
|
||||
case DELETE -> subjectDelete();
|
||||
case MEMBER_ADDED -> subjectMemberAdded();
|
||||
case UPDATE -> subjectUpdate();
|
||||
};
|
||||
}
|
||||
|
||||
public abstract Translatable subjectCreate();
|
||||
public abstract Translatable subjectDelete();
|
||||
public abstract Translatable subjectMemberAdded();
|
||||
public abstract Translatable subjectUpdate();
|
||||
|
||||
}
|
||||
|
||||
@@ -23,30 +23,9 @@ public class ItemEvent extends Event<Item>{
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Translatable describe(boolean verbose) {
|
||||
return switch (eventType()){
|
||||
case CREATE -> describeCreate();
|
||||
case null, default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private Translatable describeCreate() {
|
||||
var loc = payload().location().resolve().name();
|
||||
return t("{user} added \"{item}\" to \"{location}\"", USER,initiator().name(), ITEM, payload().name(), LOCATION, loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long objectId() {
|
||||
return payload().id();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Translatable subject() {
|
||||
var loc = payload().location().resolve().name();
|
||||
return switch (eventType()){
|
||||
case CREATE -> t("A new item has been added to \"{location}\":",LOCATION,loc);
|
||||
case null, default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,14 @@ public class Text {
|
||||
public static final String CONTACT = "Contact";
|
||||
public static final String CONTACTS = "contacts";
|
||||
public static final String CONTACT_WITH_ID = "contact ({id})";
|
||||
public static final String CREATE_BOOKMARK_SUBJECT = "create_bookmark_subject";
|
||||
public static final String CREATE_BOOKMARK_DESCRIPTION = "create_bookmark_description";
|
||||
public static final String CUSTOMER = "customer";
|
||||
public static final String CUSTOMER_SETTINGS = "customer settings";
|
||||
|
||||
public static final String DESTINATION = "destination";
|
||||
public static final String DELETE_BOOKMARK_DESCRIPTION = "The deleted bookmark was described as:\n{description}";
|
||||
public static final String DELETE_BOOKMARK_SUBJECT = "{user} deleted {url}";
|
||||
public static final String DOCUMENT = "document";
|
||||
public static final String DOCUMENTS = "documents";
|
||||
public static final String DOCUMENT_TYPE_ID = "document type id";
|
||||
@@ -43,6 +47,8 @@ public class Text {
|
||||
public static final String LOGIN_SERVICE = "login service";
|
||||
public static final String LONG = "Long";
|
||||
|
||||
public static final String MEMBER_ADDED_TO_BM_DESC = "Description:\n{description}";
|
||||
public static final String MEMBER_ADDED_TO_BM_SUBJ = "{user} shared {url}";
|
||||
public static final String MESSAGE = "message";
|
||||
public static final String MESSAGES = "messages";
|
||||
|
||||
@@ -96,6 +102,8 @@ public class Text {
|
||||
|
||||
public static final String UNIT_PRICE = "unit price";
|
||||
public static final String UNKNOWN_FIELD = "unknown field: {id}";
|
||||
public static final String UPDATE_BM_DESCRIPTION = "{user} updated bookmark";
|
||||
public static final String UPDATE_BM_SUBJECT = "{url} was changed:\n{description}";
|
||||
public static final String USER = "user";
|
||||
public static final String USERS = "users";
|
||||
|
||||
|
||||
@@ -72,7 +72,10 @@
|
||||
"CUSTOMER-NUMBER": "Kundennummer",
|
||||
"customer_number_prefix": "Präfix für Kundennummer",
|
||||
"create": "anlegen",
|
||||
"create_bookmark_description": "{url} was annotated with:\n{description}",
|
||||
"create_bookmark_subject": "{user} created new bookmark",
|
||||
"create_new_object": "{object} neu anlegen",
|
||||
"created_wiki_page":
|
||||
"CREATE_USERS": "Nutzer anlegen",
|
||||
"create_pdf": "PDF erzeugen",
|
||||
"created_with": "erzeugt mit {tool} von {producer}",
|
||||
@@ -87,12 +90,14 @@
|
||||
"data_sent": "Daten übermittelt",
|
||||
"date": "Datum",
|
||||
"delete": "löschen",
|
||||
"delete_bookmark_subject": "{user} deleted {url}",
|
||||
"delete_object": "{object} löschen",
|
||||
"DELETE_USERS": "Nutzer löschen",
|
||||
"deletes_nested": "Das wird auch alle enthaltenen Dateien löschen!",
|
||||
"delivery_date": "Lieferdatum",
|
||||
"depends_on": "hängt ab von",
|
||||
"description": "Beschreibung",
|
||||
"Description:\n{description}": "Beschreibung:\n{description}",
|
||||
"destination": "Ziel",
|
||||
"detail": "Details",
|
||||
"directory": "Verzeichnis",
|
||||
@@ -438,9 +443,11 @@
|
||||
"update": "aktualisieren",
|
||||
"UPDATE_USERS" : "Nutzer aktualisieren",
|
||||
"upload_file": "Datei hochladen",
|
||||
"{url} was changed:\n{description}": "{url} wurde geändert:\n{description}",
|
||||
"user": "Benutzer",
|
||||
"user ({id})": "Benutzer ({id})",
|
||||
"{user} added a new transaction: {entity}": "{user} hat einen neuen Umsatz hinzugefügt: {entity}",
|
||||
"{user} shared {url}": "{user} teilte {url}",
|
||||
"{user} updated the transaction '{entity}'": "{user} hat den Umsatz „{entity}“ aktualisiert",
|
||||
"user_list": "Benutzer-Liste",
|
||||
"user_module" : "Umbrella User-Verwaltung",
|
||||
|
||||
Reference in New Issue
Block a user