diff --git a/src/entities/Notification.java b/src/entities/Notification.java index c4b3681..dc875a1 100644 --- a/src/entities/Notification.java +++ b/src/entities/Notification.java @@ -28,7 +28,7 @@ public abstract class Notification { /** * Adds a decoration to the notification. Please use a decorator for that - * @param decoration + * @param decoration The decoration you want to add */ public void addDecoration(NotificationDecoration decoration) { decorations.add(decoration); @@ -39,14 +39,18 @@ public abstract class Notification { } /** - * Transition d'état spéciale pour indiquer que l'envoie de notification est en échec + * Set KO state on notification */ public void setKoState() { state = NotificationState.KO; } /** - * Fait la transition des états + * Make state transition + * PENDING -> SENT + * SENT -> READ + * + * */ public void transitionState() { switch (state) { @@ -55,14 +59,18 @@ public abstract class Notification { } } + /** + * Generates the content of the notification dynamically with the decoration (if some) + * @return + */ public String getContent() { - if (isSendable() && content != "") { + if (isSendable() && !content.equals("")) { transitionState(); for (final NotificationDecoration decoration : decorations) content = decoration.transformContent(content); - return content; + return strategy.makeContent(content); } setKoState(); return ""; diff --git a/src/utils/SendNotificationFacade.java b/src/utils/SendNotificationFacade.java index 9413af0..d3fb2ce 100644 --- a/src/utils/SendNotificationFacade.java +++ b/src/utils/SendNotificationFacade.java @@ -24,6 +24,6 @@ public class SendNotificationFacade { notificationManager.getObservable().addSubscribers(thomas); notificationManager.getObservable().addSubscribers(alexandre); - notificationManager.getObservable().sendNotifications("C# > Java (mais Rust c'est le goat)"); + notificationManager.getObservable().sendNotifications("Je préfère C#"); } }