Last active
November 4, 2015 13:57
-
-
Save FagnerMartinsBrack/9542dfa186e4d2b82b53 to your computer and use it in GitHub Desktop.
Notification Facade OO design draft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
NotificacaoContent content = /* ... constrói teu conteúdo aqui */; | |
notificacaoFacade.notify( content, beanManager ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EmailNotificationContent implements NotificationContent { | |
// Tudo customizado do conteúdo do e-mail | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EmailNotificationFacade implements SessionBean, NotificationFacade { | |
public void notify( EmailNotificationContent content, BeanManager logged ) throws InvalidContentException, AccessDeniedException, UserNotLoggedException { | |
// Notifica o sistema (inclui a notificação no banco, etc. o client não precisa saber como isso é feito) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Aqui implementamos a "NotificationContent" apenas para utilizar o polimorfismo | |
// Tem algo que é igual para o conteúdo de todas as notificações? Então adiciona na interface "NotificationContent" | |
interface NotificationContent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NotificationFacade { | |
notify( NotificationContent content, BeanManager logged ) throws InvalidContentException, AccessDeniedException, UserNotLoggedException; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment